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
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
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 #define RGB
00125
00126
00127
00128
00129
00130
00131
00132 #define RLEVOLUME
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 #undef INDEX_VOLUME
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 #define ALL_ZERO 0
00160 #define TOP_NONZERO 1
00161 #define BOT_NONZERO 2
00162 #define ALL_NONZERO 3
00163
00164
00165 #define ALL_ZERO__ALL_ZERO ((ALL_ZERO << 2) | ALL_ZERO)
00166 #define ALL_ZERO__TOP_NONZERO ((ALL_ZERO << 2) | TOP_NONZERO)
00167 #define ALL_ZERO__BOT_NONZERO ((ALL_ZERO << 2) | BOT_NONZERO)
00168 #define ALL_ZERO__ALL_NONZERO ((ALL_ZERO << 2) | ALL_NONZERO)
00169 #define TOP_NONZERO__ALL_ZERO ((TOP_NONZERO << 2) | ALL_ZERO)
00170 #define TOP_NONZERO__TOP_NONZERO ((TOP_NONZERO << 2) | TOP_NONZERO)
00171 #define TOP_NONZERO__BOT_NONZERO ((TOP_NONZERO << 2) | BOT_NONZERO)
00172 #define TOP_NONZERO__ALL_NONZERO ((TOP_NONZERO << 2) | ALL_NONZERO)
00173 #define BOT_NONZERO__ALL_ZERO ((BOT_NONZERO << 2) | ALL_ZERO)
00174 #define BOT_NONZERO__TOP_NONZERO ((BOT_NONZERO << 2) | TOP_NONZERO)
00175 #define BOT_NONZERO__BOT_NONZERO ((BOT_NONZERO << 2) | BOT_NONZERO)
00176 #define BOT_NONZERO__ALL_NONZERO ((BOT_NONZERO << 2) | ALL_NONZERO)
00177 #define ALL_NONZERO__ALL_ZERO ((ALL_NONZERO << 2) | ALL_ZERO)
00178 #define ALL_NONZERO__TOP_NONZERO ((ALL_NONZERO << 2) | TOP_NONZERO)
00179 #define ALL_NONZERO__BOT_NONZERO ((ALL_NONZERO << 2) | BOT_NONZERO)
00180 #define ALL_NONZERO__ALL_NONZERO ((ALL_NONZERO << 2) | ALL_NONZERO)
00181
00182 #ifdef SKIP_ERT
00183 #define PIXEL_IS_OPAQUE(ipixel) 0
00184 #else
00185 #define PIXEL_IS_OPAQUE(ipixel) ((ipixel)->lnk != 0)
00186 #endif
00187
00188 #ifdef STATISTICS
00189 extern int vpResampleCount;
00190 extern int vpCompositeCount;
00191 extern int vpERTSkipCount;
00192 extern int vpERTSkipAgainCount;
00193 extern int vpERTUpdateCount;
00194 extern int vpSpecialZeroSkipCount;
00195 extern int vpRunFragmentCount;
00196 #define COUNT_RESAMPLE vpResampleCount++
00197 #define COUNT_COMPOSITE vpCompositeCount++
00198 #define COUNT_ERT_SKIP vpERTSkipCount++
00199 #define COUNT_ERT_SKIP_AGAIN vpERTSkipAgainCount++
00200 #define COUNT_ERT_UPDATE vpERTUpdateCount++
00201 #define COUNT_SPECIAL_ZERO_SKIP vpSpecialZeroSkipCount++
00202 #define COUNT_RUN_FRAGMENT vpRunFragmentCount++
00203 #else
00204 #define COUNT_RESAMPLE
00205 #define COUNT_COMPOSITE
00206 #define COUNT_ERT_SKIP
00207 #define COUNT_ERT_SKIP_AGAIN
00208 #define COUNT_ERT_UPDATE
00209 #define COUNT_SPECIAL_ZERO_SKIP
00210 #define COUNT_RUN_FRAGMENT
00211 #endif
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221 void
00222 VPCompAC31B (vpc, icount, jcount, k, slice_depth_cueing_dbl, intimage,
00223 weightTLdbl, weightBLdbl, weightTRdbl, weightBRdbl,
00224 run_lengths, voxel_data )
00225 vpContext *vpc;
00226 int icount;
00227 int jcount;
00228 int k;
00229 double slice_depth_cueing_dbl;
00230 RGBIntPixel *intimage;
00231 double weightTLdbl;
00232 double weightBLdbl;
00233 double weightTRdbl;
00234 double weightBRdbl;
00235
00236 unsigned char *run_lengths;
00237 void *voxel_data;
00238
00239 {
00240 int i, j;
00241 RGBIntPixel *ipixel;
00242 RGBIntPixel *ipixel2;
00243 int update_interval;
00244 float iopc;
00245 float iopc_inv;
00246 float acc_opc;
00247 float top_opc, bot_opc;
00248 #ifdef NO_REUSE_VOXEL
00249 #define voxels_loaded 0
00250 #define CLEAR_VOXELS_LOADED
00251 #define SET_VOXELS_LOADED
00252 #else
00253 int voxels_loaded;
00254
00255 #define CLEAR_VOXELS_LOADED voxels_loaded = 0
00256 #define SET_VOXELS_LOADED voxels_loaded = 1
00257 #endif
00258 float wgtTL, wgtBL,
00259 wgtTR, wgtBR;
00260
00261
00262 unsigned char *topRLElen;
00263 unsigned char *botRLElen;
00264 char *topRLEdata;
00265 char *botRLEdata;
00266 int toprun_count;
00267 int botrun_count;
00268 int last_run_state;
00269 int run_state;
00270 int final_run_state;
00271 float min_opacity;
00272 float max_opacity;
00273 float slice_depth_cueing;
00274 float *opac_correct;
00275 int ert_skip_count;
00276 int intermediate_width;
00277 int count;
00278 float *shade_table;
00279 int norm_offset;
00280 int shade_index;
00281 float shade_factor;
00282
00283
00284 #ifdef MULTIPLE_MATERIALS
00285 float *weight_table;
00286 int wgt_offset;
00287 int weight_index;
00288 int m, num_materials;
00289 float weight1, weight2;
00290 #endif
00291
00292 #ifdef GRAYSCALE
00293 float acc_clr;
00294 float top_clr, bot_clr;
00295 #endif
00296
00297 #ifdef RGB
00298 float acc_rclr;
00299 float acc_gclr;
00300 float acc_bclr;
00301 float top_rclr;
00302 float bot_rclr;
00303 float top_gclr;
00304 float bot_gclr;
00305 float top_bclr;
00306 float bot_bclr;
00307 #endif
00308
00309 #ifdef RLEVOLUME
00310 int voxel_istride;
00311 #endif
00312
00313 #ifdef RAWVOLUME
00314 int use_octree;
00315 MMOctreeLevel level_stack[VP_MAX_OCTREE_LEVELS];
00316
00317 int scans_left;
00318 int best_view_axis;
00319 unsigned char runlen_buf1[VP_MAX_VOLUME_DIM];
00320 unsigned char runlen_buf2[VP_MAX_VOLUME_DIM];
00321 unsigned char *top_len_base;
00322 unsigned char *bot_len_base;
00323 int opac_param;
00324 float opacity;
00325 int opacity_int;
00326 int param0_offset;
00327 int param0_size;
00328 float *param0_table;
00329 int param1_offset;
00330 int param1_size;
00331 float *param1_table;
00332 int param2_offset;
00333 int param2_size;
00334 float *param2_table;
00335 #endif
00336
00337 #ifdef INDEX_VOLUME
00338 unsigned char *scanline_topRLElen;
00339 unsigned char *scanline_botRLElen;
00340 char *scanline_topRLEdata;
00341 char *scanline_botRLEdata;
00342 VoxelLocation *top_voxel_index;
00343 VoxelLocation *bot_voxel_index;
00344 VoxelLocation *vindex;
00345 int next_i;
00346 int next_scan;
00347 #endif
00348
00349 #ifdef CALLBACK
00350
00351 #ifdef GRAYSCALE
00352 void (*shade_func) ANSI_ARGS((void *, float *, void *));
00353 #endif
00354 #ifdef RGB
00355 void (*shade_func) ANSI_ARGS((void *, float *, float *, float *, void *));
00356 #endif
00357 void *client_data;
00358 #endif
00359
00360 #ifdef USE_SHADOW_BUFFER
00361 float *shadow_table;
00362 int shadow_width;
00363 GrayIntPixel *shadow_pixel;
00364 #ifdef GRAYSCALE
00365 float top_sclr, bot_sclr;
00366 #endif
00367 #ifdef RGB
00368 float top_rsclr;
00369 float bot_rsclr;
00370 float top_gsclr;
00371 float bot_gsclr;
00372 float top_bsclr;
00373 float bot_bsclr;
00374 #endif
00375 #endif
00376
00377 #ifdef DEBUG
00378 float trace_opcTL, trace_opcBL, trace_opcTR, trace_opcBR;
00379 float trace_rsclrTL, trace_rsclrBL, trace_rsclrTR, trace_rsclrBR;
00380 float trace_rclrTL, trace_rclrBL, trace_rclrTR, trace_rclrBR;
00381 float trace_gclrTL, trace_gclrBL, trace_gclrTR, trace_gclrBR;
00382 float trace_bclrTL, trace_bclrBL, trace_bclrTR, trace_bclrBR;
00383 RGBIntPixel *trace_pixel_ptr;
00384
00385 #ifdef COMPUTE_SHADOW_BUFFER
00386 int slice_u_int, shadow_slice_u_int;
00387 int slice_v_int, shadow_slice_v_int;
00388 #endif
00389 #endif
00390
00391 DECLARE_HIRES_TIME(t0);
00392 DECLARE_HIRES_TIME(t1);
00393
00394
00395
00396
00397
00398 GET_HIRES_TIME(vpc, t0);
00399
00400 wgtTL = weightTLdbl;
00401 wgtBL = weightBLdbl;
00402 wgtTR = weightTRdbl;
00403 wgtBR = weightBRdbl;
00404 slice_depth_cueing = slice_depth_cueing_dbl;
00405 min_opacity = vpc->min_opacity;
00406 max_opacity = vpc->max_opacity;
00407 #ifdef USE_SHADOW_BUFFER
00408 opac_correct = vpc->shadow_opac_correct;
00409 #else
00410 opac_correct = vpc->affine_opac_correct;
00411 #endif
00412 #ifdef COMPUTE_SHADOW_BUFFER
00413 intermediate_width = vpc->shadow_width;
00414 #else
00415 intermediate_width = vpc->intermediate_width;
00416 #endif
00417 #ifdef USE_SHADOW_BUFFER
00418 shadow_table = vpc->shadow_color_table;
00419 shadow_width = vpc->shadow_width;
00420 shadow_pixel = shadow_buffer;
00421 #endif
00422 ipixel = intimage;
00423 shade_table = vpc->shade_color_table;
00424 norm_offset = vpc->field_offset[vpc->color_field];
00425
00426 #ifdef MULTIPLE_MATERIALS
00427 weight_table = vpc->shade_weight_table;
00428 wgt_offset = vpc->field_offset[vpc->weight_field];
00429 num_materials = vpc->num_materials;
00430 #endif
00431
00432 #ifdef RLEVOLUME
00433 topRLEdata = voxel_data;
00434 botRLEdata = voxel_data;
00435 topRLElen = run_lengths;
00436 botRLElen = run_lengths;
00437 voxel_istride = vpc->rle_bytes_per_voxel;
00438 #endif
00439
00440 #ifdef RAWVOLUME
00441 ASSERT(vpc->num_clsfy_params > 0);
00442 ASSERT(vpc->num_clsfy_params < 3);
00443 param0_offset = vpc->field_offset[vpc->param_field[0]];
00444 param0_size = vpc->field_size[vpc->param_field[0]];
00445 param0_table = vpc->clsfy_table[0];
00446 if (vpc->num_clsfy_params > 1) {
00447 param1_offset = vpc->field_offset[vpc->param_field[1]];
00448 param1_size = vpc->field_size[vpc->param_field[1]];
00449 param1_table = vpc->clsfy_table[1];
00450 } else {
00451 param1_offset = 0;
00452 param1_size = 0;
00453 param1_table = NULL;
00454 }
00455 if (vpc->num_clsfy_params > 2) {
00456 param2_offset = vpc->field_offset[vpc->param_field[2]];
00457 param2_size = vpc->field_size[vpc->param_field[2]];
00458 param2_table = vpc->clsfy_table[2];
00459 } else {
00460 param2_offset = 0;
00461 param2_size = 0;
00462 param2_table = NULL;
00463 }
00464 if (vpc->mm_octree == NULL) {
00465 use_octree = 0;
00466 } else {
00467 use_octree = 1;
00468 best_view_axis = vpc->best_view_axis;
00469 VPInitOctreeLevelStack(vpc, level_stack, best_view_axis, k);
00470 scans_left = 0;
00471 bot_len_base = runlen_buf1;
00472 }
00473 #endif
00474
00475 #ifdef CALLBACK
00476 shade_func = vpc->shade_func;
00477 client_data = vpc->client_data;
00478 ASSERT(shade_func != NULL);
00479 #endif
00480
00481 #ifdef DEBUG
00482 trace_pixel_ptr = 0;
00483 if (vpc->trace_u >= 0 && vpc->trace_v >= 0) {
00484 #ifdef GRAYSCALE
00485 trace_pixel_ptr = &vpc->int_image.gray_intim[vpc->trace_u +
00486 vpc->trace_v*vpc->intermediate_width];
00487 #endif
00488 #ifdef RGB
00489 trace_pixel_ptr = &vpc->int_image.rgb_intim[vpc->trace_u +
00490 vpc->trace_v*vpc->intermediate_width];
00491 #endif
00492 #ifdef COMPUTE_SHADOW_BUFFER
00493 slice_u_int = (int)ceil(vpc->shear_i * vpc->trace_shadow_k +
00494 vpc->trans_i) - 1;
00495 shadow_slice_u_int = (int)ceil(vpc->shadow_shear_i *
00496 vpc->trace_shadow_k + vpc->shadow_trans_i) - 1;
00497 slice_v_int = (int)ceil(vpc->shear_j * vpc->trace_shadow_k
00498 + vpc->trans_j) - 1;
00499 shadow_slice_v_int = (int)ceil(vpc->shadow_shear_j *
00500 vpc->trace_shadow_k + vpc->shadow_trans_j) - 1;
00501 trace_pixel_ptr = &vpc->shadow_buffer[vpc->trace_u +
00502 shadow_slice_u_int - slice_u_int +
00503 (vpc->trace_v + shadow_slice_v_int -
00504 slice_v_int)*vpc->shadow_width];
00505 #endif
00506 }
00507 #endif
00508
00509
00510
00511
00512
00513 for (j = 0; j <= jcount; j++) {
00514
00515
00516
00517
00518
00519 i = icount;
00520 CLEAR_VOXELS_LOADED;
00521 last_run_state = ALL_ZERO;
00522
00523 #ifdef RAWVOLUME
00524 botRLEdata = (char *)voxel_data + j*voxel_jstride;
00525 topRLEdata = botRLEdata - voxel_jstride;
00526 if (!use_octree) {
00527 if (j == 0) {
00528 run_state = BOT_NONZERO;
00529 toprun_count = icount+2;
00530 botrun_count = icount;
00531 } else if (j == jcount) {
00532 run_state = TOP_NONZERO;
00533 toprun_count = icount;
00534 botrun_count = icount+2;
00535 } else {
00536 run_state = ALL_NONZERO;
00537 toprun_count = icount;
00538 botrun_count = icount;
00539 }
00540 } else
00541 #endif
00542 if (j == 0) {
00543 run_state = BOT_NONZERO;
00544 toprun_count = icount+2;
00545 botrun_count = 0;
00546 } else if (j == jcount) {
00547 run_state = TOP_NONZERO;
00548 toprun_count = 0;
00549 botrun_count = icount+2;
00550 } else {
00551 run_state = ALL_NONZERO;
00552 toprun_count = 0;
00553 botrun_count = 0;
00554 }
00555
00556 #ifdef INDEX_VOLUME
00557 scanline_topRLElen = topRLElen;
00558 scanline_botRLElen = botRLElen;
00559 scanline_topRLEdata = topRLEdata;
00560 scanline_botRLEdata = botRLEdata;
00561 if (j == 0) {
00562 top_voxel_index = voxel_index;
00563 bot_voxel_index = voxel_index;
00564 } else {
00565 top_voxel_index = bot_voxel_index;
00566 bot_voxel_index += icount;
00567 }
00568 #endif
00569
00570
00571
00572
00573
00574
00575 #ifdef RAWVOLUME
00576 if (use_octree) {
00577 top_len_base = bot_len_base;
00578 if (scans_left == 0) {
00579 if (bot_len_base == runlen_buf1)
00580 bot_len_base = runlen_buf2;
00581 else
00582 bot_len_base = runlen_buf1;
00583
00584 GET_HIRES_TIME(vpc, t1);
00585 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00586 COPY_HIRES_TIME(t0, t1);
00587
00588 scans_left = VPComputeScanRuns(vpc, level_stack, bot_len_base,
00589 best_view_axis, j, icount);
00590
00591 GET_HIRES_TIME(vpc, t1);
00592 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_OCTREE, t0, t1);
00593 COPY_HIRES_TIME(t0, t1);
00594 }
00595 #ifdef DEBUG
00596 if (j > 0)
00597 VPCheckRuns(vpc, top_len_base, best_view_axis, k, j-1);
00598 if (j < jcount)
00599 VPCheckRuns(vpc, bot_len_base, best_view_axis, k, j);
00600 #endif
00601 scans_left--;
00602 topRLElen = top_len_base;
00603 botRLElen = bot_len_base;
00604 }
00605 #endif
00606
00607
00608
00609
00610
00611 Debug((vpc, VPDEBUG_COMPOSITE, "StartIScan(u=%d,v=%d)\n",
00612 (((int)ipixel - (int)vpc->int_image.gray_intim) /
00613 sizeof(RGBIntPixel)) % vpc->intermediate_width,
00614 (((int)ipixel - (int)vpc->int_image.gray_intim) /
00615 sizeof(RGBIntPixel)) / vpc->intermediate_width));
00616
00617 #ifdef UNROLL_RUN_LOOP
00618 while (i > 0) {
00619 #else
00620 while (i >= 0) {
00621 #endif
00622
00623
00624
00625
00626 if (last_run_state == ALL_ZERO) {
00627 #ifndef UNROLL_RUN_LOOP
00628 if (i == 0) {
00629 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
00630 ipixel += 1;
00631 final_run_state = ALL_ZERO;
00632 i = -1;
00633 break;
00634 }
00635 #endif
00636
00637
00638 while (toprun_count == 0) {
00639 toprun_count = *topRLElen++;
00640 run_state ^= 1;
00641 }
00642 while (botrun_count == 0) {
00643 botrun_count = *botRLElen++;
00644 run_state ^= 2;
00645 }
00646 if (run_state == ALL_ZERO) {
00647 COUNT_SPECIAL_ZERO_SKIP;
00648
00649
00650 count = MIN(toprun_count, botrun_count);
00651 toprun_count -= count;
00652 botrun_count -= count;
00653 ipixel += count;
00654 ;
00655 ;
00656 i -= count;
00657 ASSERT(i >= 0);
00658 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(%d)\n", count));
00659 continue;
00660 }
00661 }
00662
00663 #ifndef SKIP_ERT
00664
00665
00666
00667
00668 if ((ert_skip_count = ipixel->lnk) != 0) {
00669
00670 GET_HIRES_TIME(vpc, t1);
00671 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00672 COPY_HIRES_TIME(t0, t1);
00673
00674 COUNT_ERT_SKIP;
00675
00676 #ifndef UNROLL_RUN_LOOP
00677 if (i == 0) {
00678 ipixel += 1;
00679 final_run_state = last_run_state;
00680 i = -1;
00681 Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
00682 break;
00683 }
00684 #endif
00685
00686
00687 if (ert_skip_count < i &&
00688 (count = ipixel[ert_skip_count].lnk) != 0) {
00689
00690 do {
00691 COUNT_ERT_SKIP_AGAIN;
00692 ert_skip_count += count;
00693 } while (ert_skip_count < i &&
00694 (count = ipixel[ert_skip_count].lnk) != 0);
00695
00696
00697
00698
00699
00700
00701 ipixel2 = ipixel;
00702 update_interval = 1;
00703 count = ert_skip_count - 1;
00704 while (count > 0) {
00705 COUNT_ERT_UPDATE;
00706 ipixel2 += update_interval;
00707 if (count > 255)
00708 ipixel2->lnk = 255;
00709 else
00710 ipixel2->lnk = count;
00711 update_interval *= 2;
00712 count -= update_interval;
00713 }
00714
00715
00716 COUNT_ERT_UPDATE;
00717 if (ert_skip_count > 255)
00718 ert_skip_count = 255;
00719 ipixel->lnk = ert_skip_count;
00720 }
00721
00722
00723 if (ert_skip_count > i)
00724 ert_skip_count = i;
00725 Debug((vpc, VPDEBUG_COMPOSITE,"ERTSkip(%d)\n",ert_skip_count));
00726 ipixel += ert_skip_count;
00727 CLEAR_VOXELS_LOADED;
00728
00729 #ifdef INDEX_VOLUME
00730
00731 next_i = icount - i + ert_skip_count;
00732 if (next_i == icount) {
00733 next_i--;
00734 next_scan = 1;
00735 } else {
00736 next_scan = 0;
00737 }
00738
00739
00740 vindex = &top_voxel_index[next_i];
00741 toprun_count = vindex->run_count;
00742 topRLElen = scanline_topRLElen + vindex->len_offset;
00743 if (vindex->data_offset & INDEX_RUN_IS_ZERO) {
00744 run_state &= ~1;
00745 topRLEdata = scanline_topRLEdata +
00746 (vindex->data_offset & ~INDEX_RUN_IS_ZERO);
00747 } else {
00748 run_state |= 1;
00749 topRLEdata = scanline_topRLEdata + vindex->data_offset;
00750 }
00751
00752
00753 vindex = &bot_voxel_index[next_i];
00754 botrun_count = vindex->run_count;
00755 botRLElen = scanline_botRLElen + vindex->len_offset;
00756 if (vindex->data_offset & INDEX_RUN_IS_ZERO) {
00757 run_state &= ~2;
00758 botRLEdata = scanline_botRLEdata +
00759 (vindex->data_offset & ~INDEX_RUN_IS_ZERO);
00760 } else {
00761 run_state |= 2;
00762 botRLEdata = scanline_botRLEdata + vindex->data_offset;
00763 }
00764
00765
00766 if (next_scan) {
00767
00768 while (toprun_count == 0) {
00769 toprun_count = *topRLElen++;
00770 run_state ^= 1;
00771 }
00772 toprun_count--;
00773 if (run_state & 1) {
00774 topRLEdata += 1 * voxel_istride;
00775 } else {
00776 ;
00777 }
00778
00779
00780 while (botrun_count == 0) {
00781 botrun_count = *botRLElen++;
00782 run_state ^= 2;
00783 }
00784 botrun_count--;
00785 if (run_state & 2) {
00786 botRLEdata += 1 * voxel_istride;
00787 } else {
00788 ;
00789 }
00790 }
00791
00792 #else
00793
00794 count = ert_skip_count;
00795 for (;;) {
00796 if (toprun_count >= count) {
00797 toprun_count -= count;
00798 if (run_state & 1) {
00799 topRLEdata += count * voxel_istride;
00800 } else {
00801 ;
00802 }
00803 break;
00804 } else {
00805 count -= toprun_count;
00806 if (run_state & 1) {
00807 topRLEdata += toprun_count * voxel_istride;
00808 } else {
00809 ;
00810 }
00811 toprun_count = *topRLElen++;
00812 if (toprun_count == 0)
00813 toprun_count = *topRLElen++;
00814 else
00815 run_state ^= 1;
00816 }
00817 }
00818
00819
00820 count = ert_skip_count;
00821 for (;;) {
00822 if (botrun_count >= count) {
00823 botrun_count -= count;
00824 if (run_state & 2) {
00825 botRLEdata += count * voxel_istride;
00826 } else {
00827 ;
00828 }
00829 break;
00830 } else {
00831 count -= botrun_count;
00832 if (run_state & 2) {
00833 botRLEdata += botrun_count * voxel_istride;
00834 } else {
00835 ;
00836 }
00837 botrun_count = *botRLElen++;
00838 if (botrun_count == 0)
00839 botrun_count = *botRLElen++;
00840 else
00841 run_state ^= 2;
00842 }
00843 }
00844 #endif
00845 i -= ert_skip_count;
00846 last_run_state = run_state;
00847 if (i == 0) {
00848 #ifdef UNROLL_RUN_LOOP
00849 break;
00850 #else
00851 if (last_run_state == ALL_ZERO) {
00852 ipixel += 1;
00853 final_run_state = ALL_ZERO;
00854 i = -1;
00855 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
00856 break;
00857 }
00858 if (ipixel->lnk != 0) {
00859 ipixel += 1;
00860 final_run_state = last_run_state;
00861 i = -1;
00862 Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
00863 break;
00864 }
00865 #endif
00866 }
00867
00868 GET_HIRES_TIME(vpc, t1);
00869 STORE_HIRES_TIME(vpc, VPTIMER_ERT, t0, t1);
00870 COPY_HIRES_TIME(t0, t1);
00871 }
00872 ASSERT(ipixel->opcflt < max_opacity);
00873 #endif
00874
00875
00876
00877
00878
00879 #ifndef UNROLL_RUN_LOOP
00880 if (i == 0) {
00881 final_run_state = last_run_state;
00882 run_state = ALL_ZERO;
00883 i = -1;
00884 count = 1;
00885 Debug((vpc, VPDEBUG_COMPOSITE, "Run(1)End\n"));
00886 } else {
00887 #endif
00888
00889 while (toprun_count == 0) {
00890 toprun_count = *topRLElen++;
00891 run_state ^= 1;
00892 }
00893 while (botrun_count == 0) {
00894 botrun_count = *botRLElen++;
00895 run_state ^= 2;
00896 }
00897
00898
00899 count = MIN(toprun_count, botrun_count);
00900 toprun_count -= count;
00901 botrun_count -= count;
00902 i -= count;
00903 Debug((vpc, VPDEBUG_COMPOSITE, "Run(%d)\n", count));
00904 ASSERT(i >= 0);
00905 #ifndef UNROLL_RUN_LOOP
00906 }
00907 #endif
00908 COUNT_RUN_FRAGMENT;
00909
00910
00911
00912
00913
00914 GET_HIRES_TIME(vpc, t1);
00915 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00916 COPY_HIRES_TIME(t0, t1);
00917
00918 #ifdef SKIP_COMPOSITE
00919 switch (run_state) {
00920 case ALL_ZERO:
00921 ipixel += count;
00922 ;
00923 ;
00924 count = 0;
00925 break;
00926 case TOP_NONZERO:
00927 ipixel += count;
00928 topRLEdata += count * voxel_istride;
00929 ;
00930 count = 0;
00931 break;
00932 case BOT_NONZERO:
00933 ipixel += count;
00934 ;
00935 botRLEdata += count * voxel_istride;
00936 count = 0;
00937 break;
00938 case ALL_NONZERO:
00939 ipixel += count;
00940 topRLEdata += count * voxel_istride;
00941 botRLEdata += count * voxel_istride;
00942 count = 0;
00943 break;
00944 }
00945 #else
00946 #ifdef UNROLL_RUN_LOOP
00947
00948 switch ((last_run_state << 2) | run_state) {
00949 case ALL_ZERO__ALL_ZERO:
00950
00951 ipixel += count;
00952 ;
00953 ;
00954 count = 0;
00955 break;
00956 case TOP_NONZERO__ALL_ZERO:
00957
00958
00959 if (!voxels_loaded) {
00960
00961 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
00962
00963
00964 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
00965 ;
00966
00967
00968 top_rclr =
00969 shade_table[shade_index + 3*0 + 0] * (float)1.0;
00970
00971 top_gclr =
00972 shade_table[shade_index + 3*0 + 1] * (float)1.0;
00973
00974 top_bclr =
00975 shade_table[shade_index + 3*0 + 2] * (float)1.0;
00976 ;
00977 ;
00978 ;
00979 shade_factor = top_opc * slice_depth_cueing;
00980
00981 top_rclr *= shade_factor;
00982 top_gclr *= shade_factor;
00983 top_bclr *= shade_factor;
00984 ;
00985 }
00986
00987 #ifdef DEBUG
00988 if (ipixel == trace_pixel_ptr) {
00989 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
00990 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
00991 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
00992 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
00993 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
00994 }
00995 #endif
00996 ;
00997
00998 acc_opc = top_opc * wgtTL;
00999
01000 acc_rclr = top_rclr * wgtTL;
01001 acc_gclr = top_gclr * wgtTL;
01002 acc_bclr = top_bclr * wgtTL;
01003
01004 #ifdef DEBUG
01005 if (ipixel == trace_pixel_ptr) {
01006 trace_opcTL = top_opc;
01007 trace_rclrTL = top_rclr;
01008 trace_gclrTL = top_gclr;
01009 trace_bclrTL = top_bclr;
01010
01011 }
01012 #endif
01013 ;
01014
01015 COUNT_RESAMPLE;
01016 if (acc_opc > min_opacity) {
01017 COUNT_COMPOSITE;
01018 iopc = ipixel->opcflt;
01019 # ifndef SKIP_ERT
01020 ASSERT(iopc < max_opacity);
01021 # endif
01022 iopc_inv = (float)1. - iopc;
01023
01024 ipixel->rclrflt += acc_rclr * iopc_inv;
01025 ipixel->gclrflt += acc_gclr * iopc_inv;
01026 ipixel->bclrflt += acc_bclr * iopc_inv;
01027 iopc += acc_opc * iopc_inv;
01028 ipixel->opcflt = iopc;
01029
01030 #ifdef DEBUG
01031 if (ipixel == trace_pixel_ptr) {
01032 #ifdef COMPUTE_SHADOW_BUFFER
01033 printf("{%3d} %3d %3d", k, icount-i-count, j);
01034 #else
01035 printf("[%3d] %3d %3d", k, icount-i-count, j);
01036 #endif
01037 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01038 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01039 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01040 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01041 printf(" %3.0f %3.0f\n", iopc*255.,
01042 ipixel->rclrflt);
01043
01044
01045 printf(" ");
01046 printf(" %3.0f ",trace_gclrTL);
01047 printf(" %3.0f ",trace_gclrBL);
01048 printf(" %3.0f ",trace_gclrTR);
01049 printf(" %3.0f ",trace_gclrBR);
01050 printf(" %3.0f\n", ipixel->gclrflt);
01051 printf(" ");
01052 printf(" %3.0f ",trace_bclrTL);
01053 printf(" %3.0f ",trace_bclrBL);
01054 printf(" %3.0f ",trace_bclrTR);
01055 printf(" %3.0f ",trace_bclrBR);
01056 printf(" %3.0f\n", ipixel->bclrflt);
01057 }
01058 #endif
01059 ;
01060 # ifndef SKIP_ERT
01061 if (iopc >= max_opacity) {
01062 ASSERT(ipixel->lnk == 0);
01063 ipixel->lnk = 1;
01064 }
01065 # endif
01066 };
01067 ipixel += count;
01068 ;
01069 ;
01070 count = 0;
01071 break;
01072 case BOT_NONZERO__ALL_ZERO:
01073
01074
01075 if (!voxels_loaded) {
01076
01077 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01078
01079
01080 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
01081 ;
01082
01083
01084 bot_rclr =
01085 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01086
01087 bot_gclr =
01088 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01089
01090 bot_bclr =
01091 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01092 ;
01093 ;
01094 ;
01095 shade_factor = bot_opc * slice_depth_cueing;
01096
01097 bot_rclr *= shade_factor;
01098 bot_gclr *= shade_factor;
01099 bot_bclr *= shade_factor;
01100 ;
01101 }
01102
01103 #ifdef DEBUG
01104 if (ipixel == trace_pixel_ptr) {
01105 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01106 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01107 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01108 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01109 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01110 }
01111 #endif
01112 ;
01113
01114 acc_opc = bot_opc * wgtBL;
01115
01116 acc_rclr = bot_rclr * wgtBL;
01117 acc_gclr = bot_gclr * wgtBL;
01118 acc_bclr = bot_bclr * wgtBL;
01119
01120 #ifdef DEBUG
01121 if (ipixel == trace_pixel_ptr) {
01122 trace_opcBL = bot_opc;
01123 trace_rclrBL = bot_rclr;
01124 trace_gclrBL = bot_gclr;
01125 trace_bclrBL = bot_bclr;
01126
01127 }
01128 #endif
01129 ;
01130
01131 COUNT_RESAMPLE;
01132 if (acc_opc > min_opacity) {
01133 COUNT_COMPOSITE;
01134 iopc = ipixel->opcflt;
01135 # ifndef SKIP_ERT
01136 ASSERT(iopc < max_opacity);
01137 # endif
01138 iopc_inv = (float)1. - iopc;
01139
01140 ipixel->rclrflt += acc_rclr * iopc_inv;
01141 ipixel->gclrflt += acc_gclr * iopc_inv;
01142 ipixel->bclrflt += acc_bclr * iopc_inv;
01143 iopc += acc_opc * iopc_inv;
01144 ipixel->opcflt = iopc;
01145
01146 #ifdef DEBUG
01147 if (ipixel == trace_pixel_ptr) {
01148 #ifdef COMPUTE_SHADOW_BUFFER
01149 printf("{%3d} %3d %3d", k, icount-i-count, j);
01150 #else
01151 printf("[%3d] %3d %3d", k, icount-i-count, j);
01152 #endif
01153 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01154 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01155 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01156 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01157 printf(" %3.0f %3.0f\n", iopc*255.,
01158 ipixel->rclrflt);
01159
01160
01161 printf(" ");
01162 printf(" %3.0f ",trace_gclrTL);
01163 printf(" %3.0f ",trace_gclrBL);
01164 printf(" %3.0f ",trace_gclrTR);
01165 printf(" %3.0f ",trace_gclrBR);
01166 printf(" %3.0f\n", ipixel->gclrflt);
01167 printf(" ");
01168 printf(" %3.0f ",trace_bclrTL);
01169 printf(" %3.0f ",trace_bclrBL);
01170 printf(" %3.0f ",trace_bclrTR);
01171 printf(" %3.0f ",trace_bclrBR);
01172 printf(" %3.0f\n", ipixel->bclrflt);
01173 }
01174 #endif
01175 ;
01176 # ifndef SKIP_ERT
01177 if (iopc >= max_opacity) {
01178 ASSERT(ipixel->lnk == 0);
01179 ipixel->lnk = 1;
01180 }
01181 # endif
01182 };
01183 ipixel += count;
01184 ;
01185 ;
01186 count = 0;
01187 break;
01188 case ALL_NONZERO__ALL_ZERO:
01189
01190
01191 if (!voxels_loaded) {
01192
01193 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01194
01195
01196 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
01197 ;
01198
01199
01200 top_rclr =
01201 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01202
01203 top_gclr =
01204 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01205
01206 top_bclr =
01207 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01208 ;
01209 ;
01210 ;
01211 shade_factor = top_opc * slice_depth_cueing;
01212
01213 top_rclr *= shade_factor;
01214 top_gclr *= shade_factor;
01215 top_bclr *= shade_factor;
01216 ;
01217
01218 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01219
01220
01221 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
01222 ;
01223
01224
01225 bot_rclr =
01226 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01227
01228 bot_gclr =
01229 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01230
01231 bot_bclr =
01232 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01233 ;
01234 ;
01235 ;
01236 shade_factor = bot_opc * slice_depth_cueing;
01237
01238 bot_rclr *= shade_factor;
01239 bot_gclr *= shade_factor;
01240 bot_bclr *= shade_factor;
01241 ;
01242 }
01243
01244 #ifdef DEBUG
01245 if (ipixel == trace_pixel_ptr) {
01246 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01247 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01248 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01249 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01250 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01251 }
01252 #endif
01253 ;
01254
01255 acc_opc = top_opc * wgtTL;
01256
01257 acc_rclr = top_rclr * wgtTL;
01258 acc_gclr = top_gclr * wgtTL;
01259 acc_bclr = top_bclr * wgtTL;
01260
01261 #ifdef DEBUG
01262 if (ipixel == trace_pixel_ptr) {
01263 trace_opcTL = top_opc;
01264 trace_rclrTL = top_rclr;
01265 trace_gclrTL = top_gclr;
01266 trace_bclrTL = top_bclr;
01267
01268 }
01269 #endif
01270 ;
01271
01272 acc_opc += bot_opc * wgtBL;
01273
01274 acc_rclr += bot_rclr * wgtBL;
01275 acc_gclr += bot_gclr * wgtBL;
01276 acc_bclr += bot_bclr * wgtBL;
01277
01278 #ifdef DEBUG
01279 if (ipixel == trace_pixel_ptr) {
01280 trace_opcBL = bot_opc;
01281 trace_rclrBL = bot_rclr;
01282 trace_gclrBL = bot_gclr;
01283 trace_bclrBL = bot_bclr;
01284
01285 }
01286 #endif
01287 ;
01288
01289 COUNT_RESAMPLE;
01290 if (acc_opc > min_opacity) {
01291 COUNT_COMPOSITE;
01292 iopc = ipixel->opcflt;
01293 # ifndef SKIP_ERT
01294 ASSERT(iopc < max_opacity);
01295 # endif
01296 iopc_inv = (float)1. - iopc;
01297
01298 ipixel->rclrflt += acc_rclr * iopc_inv;
01299 ipixel->gclrflt += acc_gclr * iopc_inv;
01300 ipixel->bclrflt += acc_bclr * iopc_inv;
01301 iopc += acc_opc * iopc_inv;
01302 ipixel->opcflt = iopc;
01303
01304 #ifdef DEBUG
01305 if (ipixel == trace_pixel_ptr) {
01306 #ifdef COMPUTE_SHADOW_BUFFER
01307 printf("{%3d} %3d %3d", k, icount-i-count, j);
01308 #else
01309 printf("[%3d] %3d %3d", k, icount-i-count, j);
01310 #endif
01311 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01312 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01313 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01314 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01315 printf(" %3.0f %3.0f\n", iopc*255.,
01316 ipixel->rclrflt);
01317
01318
01319 printf(" ");
01320 printf(" %3.0f ",trace_gclrTL);
01321 printf(" %3.0f ",trace_gclrBL);
01322 printf(" %3.0f ",trace_gclrTR);
01323 printf(" %3.0f ",trace_gclrBR);
01324 printf(" %3.0f\n", ipixel->gclrflt);
01325 printf(" ");
01326 printf(" %3.0f ",trace_bclrTL);
01327 printf(" %3.0f ",trace_bclrBL);
01328 printf(" %3.0f ",trace_bclrTR);
01329 printf(" %3.0f ",trace_bclrBR);
01330 printf(" %3.0f\n", ipixel->bclrflt);
01331 }
01332 #endif
01333 ;
01334 # ifndef SKIP_ERT
01335 if (iopc >= max_opacity) {
01336 ASSERT(ipixel->lnk == 0);
01337 ipixel->lnk = 1;
01338 }
01339 # endif
01340 };
01341 ipixel += count;
01342 ;
01343 ;
01344 count = 0;
01345 break;
01346 case ALL_ZERO__TOP_NONZERO:
01347
01348
01349 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01350
01351
01352 shade_index=1*3*ShortField(topRLEdata,norm_offset);
01353 ;
01354
01355
01356 top_rclr =
01357 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01358
01359 top_gclr =
01360 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01361
01362 top_bclr =
01363 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01364 ;
01365 ;
01366 ;
01367 shade_factor = top_opc * slice_depth_cueing;
01368
01369 top_rclr *= shade_factor;
01370 top_gclr *= shade_factor;
01371 top_bclr *= shade_factor;
01372 ;
01373
01374 #ifdef DEBUG
01375 if (ipixel == trace_pixel_ptr) {
01376 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01377 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01378 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01379 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01380 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01381 }
01382 #endif
01383 ;
01384
01385 acc_opc = top_opc * wgtTR;
01386
01387 acc_rclr = top_rclr * wgtTR;
01388 acc_gclr = top_gclr * wgtTR;
01389 acc_bclr = top_bclr * wgtTR;
01390
01391 #ifdef DEBUG
01392 if (ipixel == trace_pixel_ptr) {
01393 trace_opcTR = top_opc;
01394 trace_rclrTR = top_rclr;
01395 trace_gclrTR = top_gclr;
01396 trace_bclrTR = top_bclr;
01397
01398 }
01399 #endif
01400 ;
01401
01402 COUNT_RESAMPLE;
01403 if (acc_opc > min_opacity) {
01404 COUNT_COMPOSITE;
01405 iopc = ipixel->opcflt;
01406 # ifndef SKIP_ERT
01407 ASSERT(iopc < max_opacity);
01408 # endif
01409 iopc_inv = (float)1. - iopc;
01410
01411 ipixel->rclrflt += acc_rclr * iopc_inv;
01412 ipixel->gclrflt += acc_gclr * iopc_inv;
01413 ipixel->bclrflt += acc_bclr * iopc_inv;
01414 iopc += acc_opc * iopc_inv;
01415 ipixel->opcflt = iopc;
01416
01417 #ifdef DEBUG
01418 if (ipixel == trace_pixel_ptr) {
01419 #ifdef COMPUTE_SHADOW_BUFFER
01420 printf("{%3d} %3d %3d", k, icount-i-count, j);
01421 #else
01422 printf("[%3d] %3d %3d", k, icount-i-count, j);
01423 #endif
01424 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01425 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01426 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01427 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01428 printf(" %3.0f %3.0f\n", iopc*255.,
01429 ipixel->rclrflt);
01430
01431
01432 printf(" ");
01433 printf(" %3.0f ",trace_gclrTL);
01434 printf(" %3.0f ",trace_gclrBL);
01435 printf(" %3.0f ",trace_gclrTR);
01436 printf(" %3.0f ",trace_gclrBR);
01437 printf(" %3.0f\n", ipixel->gclrflt);
01438 printf(" ");
01439 printf(" %3.0f ",trace_bclrTL);
01440 printf(" %3.0f ",trace_bclrBL);
01441 printf(" %3.0f ",trace_bclrTR);
01442 printf(" %3.0f ",trace_bclrBR);
01443 printf(" %3.0f\n", ipixel->bclrflt);
01444 }
01445 #endif
01446 ;
01447 # ifndef SKIP_ERT
01448 if (iopc >= max_opacity) {
01449 ASSERT(ipixel->lnk == 0);
01450 ipixel->lnk = 1;
01451 }
01452 # endif
01453 };
01454 ipixel += 1;
01455 topRLEdata += 1 * voxel_istride;
01456 ;
01457 count--;
01458 SET_VOXELS_LOADED;
01459
01460
01461
01462 while (count > 0) {
01463 if (PIXEL_IS_OPAQUE(ipixel))
01464 break;
01465 if (!voxels_loaded) {
01466
01467 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01468
01469
01470 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
01471 ;
01472
01473
01474 top_rclr =
01475 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01476
01477 top_gclr =
01478 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01479
01480 top_bclr =
01481 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01482 ;
01483 ;
01484 ;
01485 shade_factor = top_opc * slice_depth_cueing;
01486
01487 top_rclr *= shade_factor;
01488 top_gclr *= shade_factor;
01489 top_bclr *= shade_factor;
01490 ;
01491 }
01492
01493 #ifdef DEBUG
01494 if (ipixel == trace_pixel_ptr) {
01495 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01496 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01497 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01498 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01499 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01500 }
01501 #endif
01502 ;
01503
01504 acc_opc = top_opc * wgtTL;
01505
01506 acc_rclr = top_rclr * wgtTL;
01507 acc_gclr = top_gclr * wgtTL;
01508 acc_bclr = top_bclr * wgtTL;
01509
01510 #ifdef DEBUG
01511 if (ipixel == trace_pixel_ptr) {
01512 trace_opcTL = top_opc;
01513 trace_rclrTL = top_rclr;
01514 trace_gclrTL = top_gclr;
01515 trace_bclrTL = top_bclr;
01516
01517 }
01518 #endif
01519 ;
01520
01521 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01522
01523
01524 shade_index=1*3*ShortField(topRLEdata,norm_offset);
01525 ;
01526
01527
01528 top_rclr =
01529 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01530
01531 top_gclr =
01532 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01533
01534 top_bclr =
01535 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01536 ;
01537 ;
01538 ;
01539 shade_factor = top_opc * slice_depth_cueing;
01540
01541 top_rclr *= shade_factor;
01542 top_gclr *= shade_factor;
01543 top_bclr *= shade_factor;
01544 ;
01545
01546 acc_opc += top_opc * wgtTR;
01547
01548 acc_rclr += top_rclr * wgtTR;
01549 acc_gclr += top_gclr * wgtTR;
01550 acc_bclr += top_bclr * wgtTR;
01551
01552 #ifdef DEBUG
01553 if (ipixel == trace_pixel_ptr) {
01554 trace_opcTR = top_opc;
01555 trace_rclrTR = top_rclr;
01556 trace_gclrTR = top_gclr;
01557 trace_bclrTR = top_bclr;
01558
01559 }
01560 #endif
01561 ;
01562
01563 COUNT_RESAMPLE;
01564 if (acc_opc > min_opacity) {
01565 COUNT_COMPOSITE;
01566 iopc = ipixel->opcflt;
01567 # ifndef SKIP_ERT
01568 ASSERT(iopc < max_opacity);
01569 # endif
01570 iopc_inv = (float)1. - iopc;
01571
01572 ipixel->rclrflt += acc_rclr * iopc_inv;
01573 ipixel->gclrflt += acc_gclr * iopc_inv;
01574 ipixel->bclrflt += acc_bclr * iopc_inv;
01575 iopc += acc_opc * iopc_inv;
01576 ipixel->opcflt = iopc;
01577
01578 #ifdef DEBUG
01579 if (ipixel == trace_pixel_ptr) {
01580 #ifdef COMPUTE_SHADOW_BUFFER
01581 printf("{%3d} %3d %3d", k, icount-i-count, j);
01582 #else
01583 printf("[%3d] %3d %3d", k, icount-i-count, j);
01584 #endif
01585 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01586 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01587 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01588 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01589 printf(" %3.0f %3.0f\n", iopc*255.,
01590 ipixel->rclrflt);
01591
01592
01593 printf(" ");
01594 printf(" %3.0f ",trace_gclrTL);
01595 printf(" %3.0f ",trace_gclrBL);
01596 printf(" %3.0f ",trace_gclrTR);
01597 printf(" %3.0f ",trace_gclrBR);
01598 printf(" %3.0f\n", ipixel->gclrflt);
01599 printf(" ");
01600 printf(" %3.0f ",trace_bclrTL);
01601 printf(" %3.0f ",trace_bclrBL);
01602 printf(" %3.0f ",trace_bclrTR);
01603 printf(" %3.0f ",trace_bclrBR);
01604 printf(" %3.0f\n", ipixel->bclrflt);
01605 }
01606 #endif
01607 ;
01608 # ifndef SKIP_ERT
01609 if (iopc >= max_opacity) {
01610 ASSERT(ipixel->lnk == 0);
01611 ipixel->lnk = 1;
01612 }
01613 # endif
01614 };
01615 ipixel += 1;
01616 topRLEdata += 1 * voxel_istride;
01617 ;
01618 count--;
01619 SET_VOXELS_LOADED;
01620 }
01621 break;
01622 case TOP_NONZERO__TOP_NONZERO:
01623
01624
01625 while (count > 0) {
01626 if (PIXEL_IS_OPAQUE(ipixel))
01627 break;
01628 if (!voxels_loaded) {
01629
01630 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01631
01632
01633 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
01634 ;
01635
01636
01637 top_rclr =
01638 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01639
01640 top_gclr =
01641 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01642
01643 top_bclr =
01644 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01645 ;
01646 ;
01647 ;
01648 shade_factor = top_opc * slice_depth_cueing;
01649
01650 top_rclr *= shade_factor;
01651 top_gclr *= shade_factor;
01652 top_bclr *= shade_factor;
01653 ;
01654 }
01655
01656 #ifdef DEBUG
01657 if (ipixel == trace_pixel_ptr) {
01658 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01659 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01660 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01661 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01662 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01663 }
01664 #endif
01665 ;
01666
01667 acc_opc = top_opc * wgtTL;
01668
01669 acc_rclr = top_rclr * wgtTL;
01670 acc_gclr = top_gclr * wgtTL;
01671 acc_bclr = top_bclr * wgtTL;
01672
01673 #ifdef DEBUG
01674 if (ipixel == trace_pixel_ptr) {
01675 trace_opcTL = top_opc;
01676 trace_rclrTL = top_rclr;
01677 trace_gclrTL = top_gclr;
01678 trace_bclrTL = top_bclr;
01679
01680 }
01681 #endif
01682 ;
01683
01684 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01685
01686
01687 shade_index=1*3*ShortField(topRLEdata,norm_offset);
01688 ;
01689
01690
01691 top_rclr =
01692 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01693
01694 top_gclr =
01695 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01696
01697 top_bclr =
01698 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01699 ;
01700 ;
01701 ;
01702 shade_factor = top_opc * slice_depth_cueing;
01703
01704 top_rclr *= shade_factor;
01705 top_gclr *= shade_factor;
01706 top_bclr *= shade_factor;
01707 ;
01708
01709 acc_opc += top_opc * wgtTR;
01710
01711 acc_rclr += top_rclr * wgtTR;
01712 acc_gclr += top_gclr * wgtTR;
01713 acc_bclr += top_bclr * wgtTR;
01714
01715 #ifdef DEBUG
01716 if (ipixel == trace_pixel_ptr) {
01717 trace_opcTR = top_opc;
01718 trace_rclrTR = top_rclr;
01719 trace_gclrTR = top_gclr;
01720 trace_bclrTR = top_bclr;
01721
01722 }
01723 #endif
01724 ;
01725
01726 COUNT_RESAMPLE;
01727 if (acc_opc > min_opacity) {
01728 COUNT_COMPOSITE;
01729 iopc = ipixel->opcflt;
01730 # ifndef SKIP_ERT
01731 ASSERT(iopc < max_opacity);
01732 # endif
01733 iopc_inv = (float)1. - iopc;
01734
01735 ipixel->rclrflt += acc_rclr * iopc_inv;
01736 ipixel->gclrflt += acc_gclr * iopc_inv;
01737 ipixel->bclrflt += acc_bclr * iopc_inv;
01738 iopc += acc_opc * iopc_inv;
01739 ipixel->opcflt = iopc;
01740
01741 #ifdef DEBUG
01742 if (ipixel == trace_pixel_ptr) {
01743 #ifdef COMPUTE_SHADOW_BUFFER
01744 printf("{%3d} %3d %3d", k, icount-i-count, j);
01745 #else
01746 printf("[%3d] %3d %3d", k, icount-i-count, j);
01747 #endif
01748 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01749 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01750 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01751 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01752 printf(" %3.0f %3.0f\n", iopc*255.,
01753 ipixel->rclrflt);
01754
01755
01756 printf(" ");
01757 printf(" %3.0f ",trace_gclrTL);
01758 printf(" %3.0f ",trace_gclrBL);
01759 printf(" %3.0f ",trace_gclrTR);
01760 printf(" %3.0f ",trace_gclrBR);
01761 printf(" %3.0f\n", ipixel->gclrflt);
01762 printf(" ");
01763 printf(" %3.0f ",trace_bclrTL);
01764 printf(" %3.0f ",trace_bclrBL);
01765 printf(" %3.0f ",trace_bclrTR);
01766 printf(" %3.0f ",trace_bclrBR);
01767 printf(" %3.0f\n", ipixel->bclrflt);
01768 }
01769 #endif
01770 ;
01771 # ifndef SKIP_ERT
01772 if (iopc >= max_opacity) {
01773 ASSERT(ipixel->lnk == 0);
01774 ipixel->lnk = 1;
01775 }
01776 # endif
01777 };
01778 ipixel += 1;
01779 topRLEdata += 1 * voxel_istride;
01780 ;
01781 count--;
01782 SET_VOXELS_LOADED;
01783 }
01784 break;
01785 case BOT_NONZERO__TOP_NONZERO:
01786
01787
01788 if (!voxels_loaded) {
01789
01790 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
01791
01792
01793 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
01794 ;
01795
01796
01797 bot_rclr =
01798 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01799
01800 bot_gclr =
01801 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01802
01803 bot_bclr =
01804 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01805 ;
01806 ;
01807 ;
01808 shade_factor = bot_opc * slice_depth_cueing;
01809
01810 bot_rclr *= shade_factor;
01811 bot_gclr *= shade_factor;
01812 bot_bclr *= shade_factor;
01813 ;
01814 }
01815
01816 #ifdef DEBUG
01817 if (ipixel == trace_pixel_ptr) {
01818 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01819 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01820 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01821 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01822 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01823 }
01824 #endif
01825 ;
01826
01827 acc_opc = bot_opc * wgtBL;
01828
01829 acc_rclr = bot_rclr * wgtBL;
01830 acc_gclr = bot_gclr * wgtBL;
01831 acc_bclr = bot_bclr * wgtBL;
01832
01833 #ifdef DEBUG
01834 if (ipixel == trace_pixel_ptr) {
01835 trace_opcBL = bot_opc;
01836 trace_rclrBL = bot_rclr;
01837 trace_gclrBL = bot_gclr;
01838 trace_bclrBL = bot_bclr;
01839
01840 }
01841 #endif
01842 ;
01843
01844 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
01845
01846
01847 shade_index=1*3*ShortField(topRLEdata,norm_offset);
01848 ;
01849
01850
01851 top_rclr =
01852 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01853
01854 top_gclr =
01855 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01856
01857 top_bclr =
01858 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01859 ;
01860 ;
01861 ;
01862 shade_factor = top_opc * slice_depth_cueing;
01863
01864 top_rclr *= shade_factor;
01865 top_gclr *= shade_factor;
01866 top_bclr *= shade_factor;
01867 ;
01868
01869 acc_opc += top_opc * wgtTR;
01870
01871 acc_rclr += top_rclr * wgtTR;
01872 acc_gclr += top_gclr * wgtTR;
01873 acc_bclr += top_bclr * wgtTR;
01874
01875 #ifdef DEBUG
01876 if (ipixel == trace_pixel_ptr) {
01877 trace_opcTR = top_opc;
01878 trace_rclrTR = top_rclr;
01879 trace_gclrTR = top_gclr;
01880 trace_bclrTR = top_bclr;
01881
01882 }
01883 #endif
01884 ;
01885
01886 COUNT_RESAMPLE;
01887 if (acc_opc > min_opacity) {
01888 COUNT_COMPOSITE;
01889 iopc = ipixel->opcflt;
01890 # ifndef SKIP_ERT
01891 ASSERT(iopc < max_opacity);
01892 # endif
01893 iopc_inv = (float)1. - iopc;
01894
01895 ipixel->rclrflt += acc_rclr * iopc_inv;
01896 ipixel->gclrflt += acc_gclr * iopc_inv;
01897 ipixel->bclrflt += acc_bclr * iopc_inv;
01898 iopc += acc_opc * iopc_inv;
01899 ipixel->opcflt = iopc;
01900
01901 #ifdef DEBUG
01902 if (ipixel == trace_pixel_ptr) {
01903 #ifdef COMPUTE_SHADOW_BUFFER
01904 printf("{%3d} %3d %3d", k, icount-i-count, j);
01905 #else
01906 printf("[%3d] %3d %3d", k, icount-i-count, j);
01907 #endif
01908 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01909 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01910 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01911 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01912 printf(" %3.0f %3.0f\n", iopc*255.,
01913 ipixel->rclrflt);
01914
01915
01916 printf(" ");
01917 printf(" %3.0f ",trace_gclrTL);
01918 printf(" %3.0f ",trace_gclrBL);
01919 printf(" %3.0f ",trace_gclrTR);
01920 printf(" %3.0f ",trace_gclrBR);
01921 printf(" %3.0f\n", ipixel->gclrflt);
01922 printf(" ");
01923 printf(" %3.0f ",trace_bclrTL);
01924 printf(" %3.0f ",trace_bclrBL);
01925 printf(" %3.0f ",trace_bclrTR);
01926 printf(" %3.0f ",trace_bclrBR);
01927 printf(" %3.0f\n", ipixel->bclrflt);
01928 }
01929 #endif
01930 ;
01931 # ifndef SKIP_ERT
01932 if (iopc >= max_opacity) {
01933 ASSERT(ipixel->lnk == 0);
01934 ipixel->lnk = 1;
01935 }
01936 # endif
01937 };
01938 ipixel += 1;
01939 topRLEdata += 1 * voxel_istride;
01940 ;
01941 count--;
01942 SET_VOXELS_LOADED;
01943
01944
01945
01946 while (count > 0) {
01947 if (PIXEL_IS_OPAQUE(ipixel))
01948 break;
01949 if (!voxels_loaded) {
01950
01951 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
01952
01953
01954 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
01955 ;
01956
01957
01958 top_rclr =
01959 shade_table[shade_index + 3*0 + 0] * (float)1.0;
01960
01961 top_gclr =
01962 shade_table[shade_index + 3*0 + 1] * (float)1.0;
01963
01964 top_bclr =
01965 shade_table[shade_index + 3*0 + 2] * (float)1.0;
01966 ;
01967 ;
01968 ;
01969 shade_factor = top_opc * slice_depth_cueing;
01970
01971 top_rclr *= shade_factor;
01972 top_gclr *= shade_factor;
01973 top_bclr *= shade_factor;
01974 ;
01975 }
01976
01977 #ifdef DEBUG
01978 if (ipixel == trace_pixel_ptr) {
01979 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01980 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01981 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01982 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01983 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01984 }
01985 #endif
01986 ;
01987
01988 acc_opc = top_opc * wgtTL;
01989
01990 acc_rclr = top_rclr * wgtTL;
01991 acc_gclr = top_gclr * wgtTL;
01992 acc_bclr = top_bclr * wgtTL;
01993
01994 #ifdef DEBUG
01995 if (ipixel == trace_pixel_ptr) {
01996 trace_opcTL = top_opc;
01997 trace_rclrTL = top_rclr;
01998 trace_gclrTL = top_gclr;
01999 trace_bclrTL = top_bclr;
02000
02001 }
02002 #endif
02003 ;
02004
02005 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02006
02007
02008 shade_index=1*3*ShortField(topRLEdata,norm_offset);
02009 ;
02010
02011
02012 top_rclr =
02013 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02014
02015 top_gclr =
02016 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02017
02018 top_bclr =
02019 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02020 ;
02021 ;
02022 ;
02023 shade_factor = top_opc * slice_depth_cueing;
02024
02025 top_rclr *= shade_factor;
02026 top_gclr *= shade_factor;
02027 top_bclr *= shade_factor;
02028 ;
02029
02030 acc_opc += top_opc * wgtTR;
02031
02032 acc_rclr += top_rclr * wgtTR;
02033 acc_gclr += top_gclr * wgtTR;
02034 acc_bclr += top_bclr * wgtTR;
02035
02036 #ifdef DEBUG
02037 if (ipixel == trace_pixel_ptr) {
02038 trace_opcTR = top_opc;
02039 trace_rclrTR = top_rclr;
02040 trace_gclrTR = top_gclr;
02041 trace_bclrTR = top_bclr;
02042
02043 }
02044 #endif
02045 ;
02046
02047 COUNT_RESAMPLE;
02048 if (acc_opc > min_opacity) {
02049 COUNT_COMPOSITE;
02050 iopc = ipixel->opcflt;
02051 # ifndef SKIP_ERT
02052 ASSERT(iopc < max_opacity);
02053 # endif
02054 iopc_inv = (float)1. - iopc;
02055
02056 ipixel->rclrflt += acc_rclr * iopc_inv;
02057 ipixel->gclrflt += acc_gclr * iopc_inv;
02058 ipixel->bclrflt += acc_bclr * iopc_inv;
02059 iopc += acc_opc * iopc_inv;
02060 ipixel->opcflt = iopc;
02061
02062 #ifdef DEBUG
02063 if (ipixel == trace_pixel_ptr) {
02064 #ifdef COMPUTE_SHADOW_BUFFER
02065 printf("{%3d} %3d %3d", k, icount-i-count, j);
02066 #else
02067 printf("[%3d] %3d %3d", k, icount-i-count, j);
02068 #endif
02069 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02070 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02071 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02072 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02073 printf(" %3.0f %3.0f\n", iopc*255.,
02074 ipixel->rclrflt);
02075
02076
02077 printf(" ");
02078 printf(" %3.0f ",trace_gclrTL);
02079 printf(" %3.0f ",trace_gclrBL);
02080 printf(" %3.0f ",trace_gclrTR);
02081 printf(" %3.0f ",trace_gclrBR);
02082 printf(" %3.0f\n", ipixel->gclrflt);
02083 printf(" ");
02084 printf(" %3.0f ",trace_bclrTL);
02085 printf(" %3.0f ",trace_bclrBL);
02086 printf(" %3.0f ",trace_bclrTR);
02087 printf(" %3.0f ",trace_bclrBR);
02088 printf(" %3.0f\n", ipixel->bclrflt);
02089 }
02090 #endif
02091 ;
02092 # ifndef SKIP_ERT
02093 if (iopc >= max_opacity) {
02094 ASSERT(ipixel->lnk == 0);
02095 ipixel->lnk = 1;
02096 }
02097 # endif
02098 };
02099 ipixel += 1;
02100 topRLEdata += 1 * voxel_istride;
02101 ;
02102 count--;
02103 SET_VOXELS_LOADED;
02104 }
02105 break;
02106 case ALL_NONZERO__TOP_NONZERO:
02107
02108
02109 if (!voxels_loaded) {
02110
02111 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02112
02113
02114 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
02115 ;
02116
02117
02118 top_rclr =
02119 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02120
02121 top_gclr =
02122 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02123
02124 top_bclr =
02125 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02126 ;
02127 ;
02128 ;
02129 shade_factor = top_opc * slice_depth_cueing;
02130
02131 top_rclr *= shade_factor;
02132 top_gclr *= shade_factor;
02133 top_bclr *= shade_factor;
02134 ;
02135
02136 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02137
02138
02139 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
02140 ;
02141
02142
02143 bot_rclr =
02144 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02145
02146 bot_gclr =
02147 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02148
02149 bot_bclr =
02150 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02151 ;
02152 ;
02153 ;
02154 shade_factor = bot_opc * slice_depth_cueing;
02155
02156 bot_rclr *= shade_factor;
02157 bot_gclr *= shade_factor;
02158 bot_bclr *= shade_factor;
02159 ;
02160 }
02161
02162 #ifdef DEBUG
02163 if (ipixel == trace_pixel_ptr) {
02164 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02165 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02166 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02167 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02168 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02169 }
02170 #endif
02171 ;
02172
02173 acc_opc = top_opc * wgtTL;
02174
02175 acc_rclr = top_rclr * wgtTL;
02176 acc_gclr = top_gclr * wgtTL;
02177 acc_bclr = top_bclr * wgtTL;
02178
02179 #ifdef DEBUG
02180 if (ipixel == trace_pixel_ptr) {
02181 trace_opcTL = top_opc;
02182 trace_rclrTL = top_rclr;
02183 trace_gclrTL = top_gclr;
02184 trace_bclrTL = top_bclr;
02185
02186 }
02187 #endif
02188 ;
02189
02190 acc_opc += bot_opc * wgtBL;
02191
02192 acc_rclr += bot_rclr * wgtBL;
02193 acc_gclr += bot_gclr * wgtBL;
02194 acc_bclr += bot_bclr * wgtBL;
02195
02196 #ifdef DEBUG
02197 if (ipixel == trace_pixel_ptr) {
02198 trace_opcBL = bot_opc;
02199 trace_rclrBL = bot_rclr;
02200 trace_gclrBL = bot_gclr;
02201 trace_bclrBL = bot_bclr;
02202
02203 }
02204 #endif
02205 ;
02206
02207 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02208
02209
02210 shade_index=1*3*ShortField(topRLEdata,norm_offset);
02211 ;
02212
02213
02214 top_rclr =
02215 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02216
02217 top_gclr =
02218 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02219
02220 top_bclr =
02221 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02222 ;
02223 ;
02224 ;
02225 shade_factor = top_opc * slice_depth_cueing;
02226
02227 top_rclr *= shade_factor;
02228 top_gclr *= shade_factor;
02229 top_bclr *= shade_factor;
02230 ;
02231
02232 acc_opc += top_opc * wgtTR;
02233
02234 acc_rclr += top_rclr * wgtTR;
02235 acc_gclr += top_gclr * wgtTR;
02236 acc_bclr += top_bclr * wgtTR;
02237
02238 #ifdef DEBUG
02239 if (ipixel == trace_pixel_ptr) {
02240 trace_opcTR = top_opc;
02241 trace_rclrTR = top_rclr;
02242 trace_gclrTR = top_gclr;
02243 trace_bclrTR = top_bclr;
02244
02245 }
02246 #endif
02247 ;
02248
02249 COUNT_RESAMPLE;
02250 if (acc_opc > min_opacity) {
02251 COUNT_COMPOSITE;
02252 iopc = ipixel->opcflt;
02253 # ifndef SKIP_ERT
02254 ASSERT(iopc < max_opacity);
02255 # endif
02256 iopc_inv = (float)1. - iopc;
02257
02258 ipixel->rclrflt += acc_rclr * iopc_inv;
02259 ipixel->gclrflt += acc_gclr * iopc_inv;
02260 ipixel->bclrflt += acc_bclr * iopc_inv;
02261 iopc += acc_opc * iopc_inv;
02262 ipixel->opcflt = iopc;
02263
02264 #ifdef DEBUG
02265 if (ipixel == trace_pixel_ptr) {
02266 #ifdef COMPUTE_SHADOW_BUFFER
02267 printf("{%3d} %3d %3d", k, icount-i-count, j);
02268 #else
02269 printf("[%3d] %3d %3d", k, icount-i-count, j);
02270 #endif
02271 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02272 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02273 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02274 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02275 printf(" %3.0f %3.0f\n", iopc*255.,
02276 ipixel->rclrflt);
02277
02278
02279 printf(" ");
02280 printf(" %3.0f ",trace_gclrTL);
02281 printf(" %3.0f ",trace_gclrBL);
02282 printf(" %3.0f ",trace_gclrTR);
02283 printf(" %3.0f ",trace_gclrBR);
02284 printf(" %3.0f\n", ipixel->gclrflt);
02285 printf(" ");
02286 printf(" %3.0f ",trace_bclrTL);
02287 printf(" %3.0f ",trace_bclrBL);
02288 printf(" %3.0f ",trace_bclrTR);
02289 printf(" %3.0f ",trace_bclrBR);
02290 printf(" %3.0f\n", ipixel->bclrflt);
02291 }
02292 #endif
02293 ;
02294 # ifndef SKIP_ERT
02295 if (iopc >= max_opacity) {
02296 ASSERT(ipixel->lnk == 0);
02297 ipixel->lnk = 1;
02298 }
02299 # endif
02300 };
02301 ipixel += 1;
02302 topRLEdata += 1 * voxel_istride;
02303 ;
02304 count--;
02305 SET_VOXELS_LOADED;
02306
02307
02308
02309 while (count > 0) {
02310 if (PIXEL_IS_OPAQUE(ipixel))
02311 break;
02312 if (!voxels_loaded) {
02313
02314 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02315
02316
02317 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
02318 ;
02319
02320
02321 top_rclr =
02322 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02323
02324 top_gclr =
02325 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02326
02327 top_bclr =
02328 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02329 ;
02330 ;
02331 ;
02332 shade_factor = top_opc * slice_depth_cueing;
02333
02334 top_rclr *= shade_factor;
02335 top_gclr *= shade_factor;
02336 top_bclr *= shade_factor;
02337 ;
02338 }
02339
02340 #ifdef DEBUG
02341 if (ipixel == trace_pixel_ptr) {
02342 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02343 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02344 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02345 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02346 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02347 }
02348 #endif
02349 ;
02350
02351 acc_opc = top_opc * wgtTL;
02352
02353 acc_rclr = top_rclr * wgtTL;
02354 acc_gclr = top_gclr * wgtTL;
02355 acc_bclr = top_bclr * wgtTL;
02356
02357 #ifdef DEBUG
02358 if (ipixel == trace_pixel_ptr) {
02359 trace_opcTL = top_opc;
02360 trace_rclrTL = top_rclr;
02361 trace_gclrTL = top_gclr;
02362 trace_bclrTL = top_bclr;
02363
02364 }
02365 #endif
02366 ;
02367
02368 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
02369
02370
02371 shade_index=1*3*ShortField(topRLEdata,norm_offset);
02372 ;
02373
02374
02375 top_rclr =
02376 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02377
02378 top_gclr =
02379 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02380
02381 top_bclr =
02382 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02383 ;
02384 ;
02385 ;
02386 shade_factor = top_opc * slice_depth_cueing;
02387
02388 top_rclr *= shade_factor;
02389 top_gclr *= shade_factor;
02390 top_bclr *= shade_factor;
02391 ;
02392
02393 acc_opc += top_opc * wgtTR;
02394
02395 acc_rclr += top_rclr * wgtTR;
02396 acc_gclr += top_gclr * wgtTR;
02397 acc_bclr += top_bclr * wgtTR;
02398
02399 #ifdef DEBUG
02400 if (ipixel == trace_pixel_ptr) {
02401 trace_opcTR = top_opc;
02402 trace_rclrTR = top_rclr;
02403 trace_gclrTR = top_gclr;
02404 trace_bclrTR = top_bclr;
02405
02406 }
02407 #endif
02408 ;
02409
02410 COUNT_RESAMPLE;
02411 if (acc_opc > min_opacity) {
02412 COUNT_COMPOSITE;
02413 iopc = ipixel->opcflt;
02414 # ifndef SKIP_ERT
02415 ASSERT(iopc < max_opacity);
02416 # endif
02417 iopc_inv = (float)1. - iopc;
02418
02419 ipixel->rclrflt += acc_rclr * iopc_inv;
02420 ipixel->gclrflt += acc_gclr * iopc_inv;
02421 ipixel->bclrflt += acc_bclr * iopc_inv;
02422 iopc += acc_opc * iopc_inv;
02423 ipixel->opcflt = iopc;
02424
02425 #ifdef DEBUG
02426 if (ipixel == trace_pixel_ptr) {
02427 #ifdef COMPUTE_SHADOW_BUFFER
02428 printf("{%3d} %3d %3d", k, icount-i-count, j);
02429 #else
02430 printf("[%3d] %3d %3d", k, icount-i-count, j);
02431 #endif
02432 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02433 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02434 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02435 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02436 printf(" %3.0f %3.0f\n", iopc*255.,
02437 ipixel->rclrflt);
02438
02439
02440 printf(" ");
02441 printf(" %3.0f ",trace_gclrTL);
02442 printf(" %3.0f ",trace_gclrBL);
02443 printf(" %3.0f ",trace_gclrTR);
02444 printf(" %3.0f ",trace_gclrBR);
02445 printf(" %3.0f\n", ipixel->gclrflt);
02446 printf(" ");
02447 printf(" %3.0f ",trace_bclrTL);
02448 printf(" %3.0f ",trace_bclrBL);
02449 printf(" %3.0f ",trace_bclrTR);
02450 printf(" %3.0f ",trace_bclrBR);
02451 printf(" %3.0f\n", ipixel->bclrflt);
02452 }
02453 #endif
02454 ;
02455 # ifndef SKIP_ERT
02456 if (iopc >= max_opacity) {
02457 ASSERT(ipixel->lnk == 0);
02458 ipixel->lnk = 1;
02459 }
02460 # endif
02461 };
02462 ipixel += 1;
02463 topRLEdata += 1 * voxel_istride;
02464 ;
02465 count--;
02466 SET_VOXELS_LOADED;
02467 }
02468 break;
02469 case ALL_ZERO__BOT_NONZERO:
02470
02471
02472 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02473
02474
02475 shade_index=1*3*ShortField(botRLEdata,norm_offset);
02476 ;
02477
02478
02479 bot_rclr =
02480 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02481
02482 bot_gclr =
02483 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02484
02485 bot_bclr =
02486 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02487 ;
02488 ;
02489 ;
02490 shade_factor = bot_opc * slice_depth_cueing;
02491
02492 bot_rclr *= shade_factor;
02493 bot_gclr *= shade_factor;
02494 bot_bclr *= shade_factor;
02495 ;
02496
02497 #ifdef DEBUG
02498 if (ipixel == trace_pixel_ptr) {
02499 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02500 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02501 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02502 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02503 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02504 }
02505 #endif
02506 ;
02507
02508 acc_opc = bot_opc * wgtBR;
02509
02510 acc_rclr = bot_rclr * wgtBR;
02511 acc_gclr = bot_gclr * wgtBR;
02512 acc_bclr = bot_bclr * wgtBR;
02513
02514 #ifdef DEBUG
02515 if (ipixel == trace_pixel_ptr) {
02516 trace_opcBR = bot_opc;
02517 trace_rclrBR = bot_rclr;
02518 trace_gclrBR = bot_gclr;
02519 trace_bclrBR = bot_bclr;
02520
02521 }
02522 #endif
02523 ;
02524
02525 COUNT_RESAMPLE;
02526 if (acc_opc > min_opacity) {
02527 COUNT_COMPOSITE;
02528 iopc = ipixel->opcflt;
02529 # ifndef SKIP_ERT
02530 ASSERT(iopc < max_opacity);
02531 # endif
02532 iopc_inv = (float)1. - iopc;
02533
02534 ipixel->rclrflt += acc_rclr * iopc_inv;
02535 ipixel->gclrflt += acc_gclr * iopc_inv;
02536 ipixel->bclrflt += acc_bclr * iopc_inv;
02537 iopc += acc_opc * iopc_inv;
02538 ipixel->opcflt = iopc;
02539
02540 #ifdef DEBUG
02541 if (ipixel == trace_pixel_ptr) {
02542 #ifdef COMPUTE_SHADOW_BUFFER
02543 printf("{%3d} %3d %3d", k, icount-i-count, j);
02544 #else
02545 printf("[%3d] %3d %3d", k, icount-i-count, j);
02546 #endif
02547 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02548 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02549 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02550 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02551 printf(" %3.0f %3.0f\n", iopc*255.,
02552 ipixel->rclrflt);
02553
02554
02555 printf(" ");
02556 printf(" %3.0f ",trace_gclrTL);
02557 printf(" %3.0f ",trace_gclrBL);
02558 printf(" %3.0f ",trace_gclrTR);
02559 printf(" %3.0f ",trace_gclrBR);
02560 printf(" %3.0f\n", ipixel->gclrflt);
02561 printf(" ");
02562 printf(" %3.0f ",trace_bclrTL);
02563 printf(" %3.0f ",trace_bclrBL);
02564 printf(" %3.0f ",trace_bclrTR);
02565 printf(" %3.0f ",trace_bclrBR);
02566 printf(" %3.0f\n", ipixel->bclrflt);
02567 }
02568 #endif
02569 ;
02570 # ifndef SKIP_ERT
02571 if (iopc >= max_opacity) {
02572 ASSERT(ipixel->lnk == 0);
02573 ipixel->lnk = 1;
02574 }
02575 # endif
02576 };
02577 ipixel += 1;
02578 ;
02579 botRLEdata += 1 * voxel_istride;
02580 count--;
02581 SET_VOXELS_LOADED;
02582
02583
02584
02585 while (count > 0) {
02586 if (PIXEL_IS_OPAQUE(ipixel))
02587 break;
02588 if (!voxels_loaded) {
02589
02590 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02591
02592
02593 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
02594 ;
02595
02596
02597 bot_rclr =
02598 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02599
02600 bot_gclr =
02601 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02602
02603 bot_bclr =
02604 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02605 ;
02606 ;
02607 ;
02608 shade_factor = bot_opc * slice_depth_cueing;
02609
02610 bot_rclr *= shade_factor;
02611 bot_gclr *= shade_factor;
02612 bot_bclr *= shade_factor;
02613 ;
02614 }
02615
02616 #ifdef DEBUG
02617 if (ipixel == trace_pixel_ptr) {
02618 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02619 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02620 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02621 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02622 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02623 }
02624 #endif
02625 ;
02626
02627 acc_opc = bot_opc * wgtBL;
02628
02629 acc_rclr = bot_rclr * wgtBL;
02630 acc_gclr = bot_gclr * wgtBL;
02631 acc_bclr = bot_bclr * wgtBL;
02632
02633 #ifdef DEBUG
02634 if (ipixel == trace_pixel_ptr) {
02635 trace_opcBL = bot_opc;
02636 trace_rclrBL = bot_rclr;
02637 trace_gclrBL = bot_gclr;
02638 trace_bclrBL = bot_bclr;
02639
02640 }
02641 #endif
02642 ;
02643
02644 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02645
02646
02647 shade_index=1*3*ShortField(botRLEdata,norm_offset);
02648 ;
02649
02650
02651 bot_rclr =
02652 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02653
02654 bot_gclr =
02655 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02656
02657 bot_bclr =
02658 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02659 ;
02660 ;
02661 ;
02662 shade_factor = bot_opc * slice_depth_cueing;
02663
02664 bot_rclr *= shade_factor;
02665 bot_gclr *= shade_factor;
02666 bot_bclr *= shade_factor;
02667 ;
02668
02669 acc_opc += bot_opc * wgtBR;
02670
02671 acc_rclr += bot_rclr * wgtBR;
02672 acc_gclr += bot_gclr * wgtBR;
02673 acc_bclr += bot_bclr * wgtBR;
02674
02675 #ifdef DEBUG
02676 if (ipixel == trace_pixel_ptr) {
02677 trace_opcBR = bot_opc;
02678 trace_rclrBR = bot_rclr;
02679 trace_gclrBR = bot_gclr;
02680 trace_bclrBR = bot_bclr;
02681
02682 }
02683 #endif
02684 ;
02685
02686 COUNT_RESAMPLE;
02687 if (acc_opc > min_opacity) {
02688 COUNT_COMPOSITE;
02689 iopc = ipixel->opcflt;
02690 # ifndef SKIP_ERT
02691 ASSERT(iopc < max_opacity);
02692 # endif
02693 iopc_inv = (float)1. - iopc;
02694
02695 ipixel->rclrflt += acc_rclr * iopc_inv;
02696 ipixel->gclrflt += acc_gclr * iopc_inv;
02697 ipixel->bclrflt += acc_bclr * iopc_inv;
02698 iopc += acc_opc * iopc_inv;
02699 ipixel->opcflt = iopc;
02700
02701 #ifdef DEBUG
02702 if (ipixel == trace_pixel_ptr) {
02703 #ifdef COMPUTE_SHADOW_BUFFER
02704 printf("{%3d} %3d %3d", k, icount-i-count, j);
02705 #else
02706 printf("[%3d] %3d %3d", k, icount-i-count, j);
02707 #endif
02708 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02709 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02710 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02711 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02712 printf(" %3.0f %3.0f\n", iopc*255.,
02713 ipixel->rclrflt);
02714
02715
02716 printf(" ");
02717 printf(" %3.0f ",trace_gclrTL);
02718 printf(" %3.0f ",trace_gclrBL);
02719 printf(" %3.0f ",trace_gclrTR);
02720 printf(" %3.0f ",trace_gclrBR);
02721 printf(" %3.0f\n", ipixel->gclrflt);
02722 printf(" ");
02723 printf(" %3.0f ",trace_bclrTL);
02724 printf(" %3.0f ",trace_bclrBL);
02725 printf(" %3.0f ",trace_bclrTR);
02726 printf(" %3.0f ",trace_bclrBR);
02727 printf(" %3.0f\n", ipixel->bclrflt);
02728 }
02729 #endif
02730 ;
02731 # ifndef SKIP_ERT
02732 if (iopc >= max_opacity) {
02733 ASSERT(ipixel->lnk == 0);
02734 ipixel->lnk = 1;
02735 }
02736 # endif
02737 };
02738 ipixel += 1;
02739 ;
02740 botRLEdata += 1 * voxel_istride;
02741 count--;
02742 SET_VOXELS_LOADED;
02743 }
02744 break;
02745 case TOP_NONZERO__BOT_NONZERO:
02746
02747 if (!voxels_loaded) {
02748
02749 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
02750
02751
02752 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
02753 ;
02754
02755
02756 top_rclr =
02757 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02758
02759 top_gclr =
02760 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02761
02762 top_bclr =
02763 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02764 ;
02765 ;
02766 ;
02767 shade_factor = top_opc * slice_depth_cueing;
02768
02769 top_rclr *= shade_factor;
02770 top_gclr *= shade_factor;
02771 top_bclr *= shade_factor;
02772 ;
02773 }
02774
02775 #ifdef DEBUG
02776 if (ipixel == trace_pixel_ptr) {
02777 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02778 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02779 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02780 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02781 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02782 }
02783 #endif
02784 ;
02785
02786 acc_opc = top_opc * wgtTL;
02787
02788 acc_rclr = top_rclr * wgtTL;
02789 acc_gclr = top_gclr * wgtTL;
02790 acc_bclr = top_bclr * wgtTL;
02791
02792 #ifdef DEBUG
02793 if (ipixel == trace_pixel_ptr) {
02794 trace_opcTL = top_opc;
02795 trace_rclrTL = top_rclr;
02796 trace_gclrTL = top_gclr;
02797 trace_bclrTL = top_bclr;
02798
02799 }
02800 #endif
02801 ;
02802
02803 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02804
02805
02806 shade_index=1*3*ShortField(botRLEdata,norm_offset);
02807 ;
02808
02809
02810 bot_rclr =
02811 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02812
02813 bot_gclr =
02814 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02815
02816 bot_bclr =
02817 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02818 ;
02819 ;
02820 ;
02821 shade_factor = bot_opc * slice_depth_cueing;
02822
02823 bot_rclr *= shade_factor;
02824 bot_gclr *= shade_factor;
02825 bot_bclr *= shade_factor;
02826 ;
02827
02828 acc_opc += bot_opc * wgtBR;
02829
02830 acc_rclr += bot_rclr * wgtBR;
02831 acc_gclr += bot_gclr * wgtBR;
02832 acc_bclr += bot_bclr * wgtBR;
02833
02834 #ifdef DEBUG
02835 if (ipixel == trace_pixel_ptr) {
02836 trace_opcBR = bot_opc;
02837 trace_rclrBR = bot_rclr;
02838 trace_gclrBR = bot_gclr;
02839 trace_bclrBR = bot_bclr;
02840
02841 }
02842 #endif
02843 ;
02844
02845 COUNT_RESAMPLE;
02846 if (acc_opc > min_opacity) {
02847 COUNT_COMPOSITE;
02848 iopc = ipixel->opcflt;
02849 # ifndef SKIP_ERT
02850 ASSERT(iopc < max_opacity);
02851 # endif
02852 iopc_inv = (float)1. - iopc;
02853
02854 ipixel->rclrflt += acc_rclr * iopc_inv;
02855 ipixel->gclrflt += acc_gclr * iopc_inv;
02856 ipixel->bclrflt += acc_bclr * iopc_inv;
02857 iopc += acc_opc * iopc_inv;
02858 ipixel->opcflt = iopc;
02859
02860 #ifdef DEBUG
02861 if (ipixel == trace_pixel_ptr) {
02862 #ifdef COMPUTE_SHADOW_BUFFER
02863 printf("{%3d} %3d %3d", k, icount-i-count, j);
02864 #else
02865 printf("[%3d] %3d %3d", k, icount-i-count, j);
02866 #endif
02867 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02868 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02869 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02870 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02871 printf(" %3.0f %3.0f\n", iopc*255.,
02872 ipixel->rclrflt);
02873
02874
02875 printf(" ");
02876 printf(" %3.0f ",trace_gclrTL);
02877 printf(" %3.0f ",trace_gclrBL);
02878 printf(" %3.0f ",trace_gclrTR);
02879 printf(" %3.0f ",trace_gclrBR);
02880 printf(" %3.0f\n", ipixel->gclrflt);
02881 printf(" ");
02882 printf(" %3.0f ",trace_bclrTL);
02883 printf(" %3.0f ",trace_bclrBL);
02884 printf(" %3.0f ",trace_bclrTR);
02885 printf(" %3.0f ",trace_bclrBR);
02886 printf(" %3.0f\n", ipixel->bclrflt);
02887 }
02888 #endif
02889 ;
02890 # ifndef SKIP_ERT
02891 if (iopc >= max_opacity) {
02892 ASSERT(ipixel->lnk == 0);
02893 ipixel->lnk = 1;
02894 }
02895 # endif
02896 };
02897 ipixel += 1;
02898 ;
02899 botRLEdata += 1 * voxel_istride;
02900 count--;
02901 SET_VOXELS_LOADED;
02902
02903
02904
02905 while (count > 0) {
02906 if (PIXEL_IS_OPAQUE(ipixel))
02907 break;
02908 if (!voxels_loaded) {
02909
02910 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
02911
02912
02913 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
02914 ;
02915
02916
02917 bot_rclr =
02918 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02919
02920 bot_gclr =
02921 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02922
02923 bot_bclr =
02924 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02925 ;
02926 ;
02927 ;
02928 shade_factor = bot_opc * slice_depth_cueing;
02929
02930 bot_rclr *= shade_factor;
02931 bot_gclr *= shade_factor;
02932 bot_bclr *= shade_factor;
02933 ;
02934 }
02935
02936 #ifdef DEBUG
02937 if (ipixel == trace_pixel_ptr) {
02938 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02939 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02940 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02941 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02942 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02943 }
02944 #endif
02945 ;
02946
02947 acc_opc = bot_opc * wgtBL;
02948
02949 acc_rclr = bot_rclr * wgtBL;
02950 acc_gclr = bot_gclr * wgtBL;
02951 acc_bclr = bot_bclr * wgtBL;
02952
02953 #ifdef DEBUG
02954 if (ipixel == trace_pixel_ptr) {
02955 trace_opcBL = bot_opc;
02956 trace_rclrBL = bot_rclr;
02957 trace_gclrBL = bot_gclr;
02958 trace_bclrBL = bot_bclr;
02959
02960 }
02961 #endif
02962 ;
02963
02964 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
02965
02966
02967 shade_index=1*3*ShortField(botRLEdata,norm_offset);
02968 ;
02969
02970
02971 bot_rclr =
02972 shade_table[shade_index + 3*0 + 0] * (float)1.0;
02973
02974 bot_gclr =
02975 shade_table[shade_index + 3*0 + 1] * (float)1.0;
02976
02977 bot_bclr =
02978 shade_table[shade_index + 3*0 + 2] * (float)1.0;
02979 ;
02980 ;
02981 ;
02982 shade_factor = bot_opc * slice_depth_cueing;
02983
02984 bot_rclr *= shade_factor;
02985 bot_gclr *= shade_factor;
02986 bot_bclr *= shade_factor;
02987 ;
02988
02989 acc_opc += bot_opc * wgtBR;
02990
02991 acc_rclr += bot_rclr * wgtBR;
02992 acc_gclr += bot_gclr * wgtBR;
02993 acc_bclr += bot_bclr * wgtBR;
02994
02995 #ifdef DEBUG
02996 if (ipixel == trace_pixel_ptr) {
02997 trace_opcBR = bot_opc;
02998 trace_rclrBR = bot_rclr;
02999 trace_gclrBR = bot_gclr;
03000 trace_bclrBR = bot_bclr;
03001
03002 }
03003 #endif
03004 ;
03005
03006 COUNT_RESAMPLE;
03007 if (acc_opc > min_opacity) {
03008 COUNT_COMPOSITE;
03009 iopc = ipixel->opcflt;
03010 # ifndef SKIP_ERT
03011 ASSERT(iopc < max_opacity);
03012 # endif
03013 iopc_inv = (float)1. - iopc;
03014
03015 ipixel->rclrflt += acc_rclr * iopc_inv;
03016 ipixel->gclrflt += acc_gclr * iopc_inv;
03017 ipixel->bclrflt += acc_bclr * iopc_inv;
03018 iopc += acc_opc * iopc_inv;
03019 ipixel->opcflt = iopc;
03020
03021 #ifdef DEBUG
03022 if (ipixel == trace_pixel_ptr) {
03023 #ifdef COMPUTE_SHADOW_BUFFER
03024 printf("{%3d} %3d %3d", k, icount-i-count, j);
03025 #else
03026 printf("[%3d] %3d %3d", k, icount-i-count, j);
03027 #endif
03028 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03029 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03030 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03031 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03032 printf(" %3.0f %3.0f\n", iopc*255.,
03033 ipixel->rclrflt);
03034
03035
03036 printf(" ");
03037 printf(" %3.0f ",trace_gclrTL);
03038 printf(" %3.0f ",trace_gclrBL);
03039 printf(" %3.0f ",trace_gclrTR);
03040 printf(" %3.0f ",trace_gclrBR);
03041 printf(" %3.0f\n", ipixel->gclrflt);
03042 printf(" ");
03043 printf(" %3.0f ",trace_bclrTL);
03044 printf(" %3.0f ",trace_bclrBL);
03045 printf(" %3.0f ",trace_bclrTR);
03046 printf(" %3.0f ",trace_bclrBR);
03047 printf(" %3.0f\n", ipixel->bclrflt);
03048 }
03049 #endif
03050 ;
03051 # ifndef SKIP_ERT
03052 if (iopc >= max_opacity) {
03053 ASSERT(ipixel->lnk == 0);
03054 ipixel->lnk = 1;
03055 }
03056 # endif
03057 };
03058 ipixel += 1;
03059 ;
03060 botRLEdata += 1 * voxel_istride;
03061 count--;
03062 SET_VOXELS_LOADED;
03063 }
03064 break;
03065 case BOT_NONZERO__BOT_NONZERO:
03066
03067
03068 while (count > 0) {
03069 if (PIXEL_IS_OPAQUE(ipixel))
03070 break;
03071 if (!voxels_loaded) {
03072
03073 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03074
03075
03076 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
03077 ;
03078
03079
03080 bot_rclr =
03081 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03082
03083 bot_gclr =
03084 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03085
03086 bot_bclr =
03087 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03088 ;
03089 ;
03090 ;
03091 shade_factor = bot_opc * slice_depth_cueing;
03092
03093 bot_rclr *= shade_factor;
03094 bot_gclr *= shade_factor;
03095 bot_bclr *= shade_factor;
03096 ;
03097 }
03098
03099 #ifdef DEBUG
03100 if (ipixel == trace_pixel_ptr) {
03101 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03102 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03103 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03104 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03105 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03106 }
03107 #endif
03108 ;
03109
03110 acc_opc = bot_opc * wgtBL;
03111
03112 acc_rclr = bot_rclr * wgtBL;
03113 acc_gclr = bot_gclr * wgtBL;
03114 acc_bclr = bot_bclr * wgtBL;
03115
03116 #ifdef DEBUG
03117 if (ipixel == trace_pixel_ptr) {
03118 trace_opcBL = bot_opc;
03119 trace_rclrBL = bot_rclr;
03120 trace_gclrBL = bot_gclr;
03121 trace_bclrBL = bot_bclr;
03122
03123 }
03124 #endif
03125 ;
03126
03127 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03128
03129
03130 shade_index=1*3*ShortField(botRLEdata,norm_offset);
03131 ;
03132
03133
03134 bot_rclr =
03135 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03136
03137 bot_gclr =
03138 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03139
03140 bot_bclr =
03141 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03142 ;
03143 ;
03144 ;
03145 shade_factor = bot_opc * slice_depth_cueing;
03146
03147 bot_rclr *= shade_factor;
03148 bot_gclr *= shade_factor;
03149 bot_bclr *= shade_factor;
03150 ;
03151
03152 acc_opc += bot_opc * wgtBR;
03153
03154 acc_rclr += bot_rclr * wgtBR;
03155 acc_gclr += bot_gclr * wgtBR;
03156 acc_bclr += bot_bclr * wgtBR;
03157
03158 #ifdef DEBUG
03159 if (ipixel == trace_pixel_ptr) {
03160 trace_opcBR = bot_opc;
03161 trace_rclrBR = bot_rclr;
03162 trace_gclrBR = bot_gclr;
03163 trace_bclrBR = bot_bclr;
03164
03165 }
03166 #endif
03167 ;
03168
03169 COUNT_RESAMPLE;
03170 if (acc_opc > min_opacity) {
03171 COUNT_COMPOSITE;
03172 iopc = ipixel->opcflt;
03173 # ifndef SKIP_ERT
03174 ASSERT(iopc < max_opacity);
03175 # endif
03176 iopc_inv = (float)1. - iopc;
03177
03178 ipixel->rclrflt += acc_rclr * iopc_inv;
03179 ipixel->gclrflt += acc_gclr * iopc_inv;
03180 ipixel->bclrflt += acc_bclr * iopc_inv;
03181 iopc += acc_opc * iopc_inv;
03182 ipixel->opcflt = iopc;
03183
03184 #ifdef DEBUG
03185 if (ipixel == trace_pixel_ptr) {
03186 #ifdef COMPUTE_SHADOW_BUFFER
03187 printf("{%3d} %3d %3d", k, icount-i-count, j);
03188 #else
03189 printf("[%3d] %3d %3d", k, icount-i-count, j);
03190 #endif
03191 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03192 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03193 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03194 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03195 printf(" %3.0f %3.0f\n", iopc*255.,
03196 ipixel->rclrflt);
03197
03198
03199 printf(" ");
03200 printf(" %3.0f ",trace_gclrTL);
03201 printf(" %3.0f ",trace_gclrBL);
03202 printf(" %3.0f ",trace_gclrTR);
03203 printf(" %3.0f ",trace_gclrBR);
03204 printf(" %3.0f\n", ipixel->gclrflt);
03205 printf(" ");
03206 printf(" %3.0f ",trace_bclrTL);
03207 printf(" %3.0f ",trace_bclrBL);
03208 printf(" %3.0f ",trace_bclrTR);
03209 printf(" %3.0f ",trace_bclrBR);
03210 printf(" %3.0f\n", ipixel->bclrflt);
03211 }
03212 #endif
03213 ;
03214 # ifndef SKIP_ERT
03215 if (iopc >= max_opacity) {
03216 ASSERT(ipixel->lnk == 0);
03217 ipixel->lnk = 1;
03218 }
03219 # endif
03220 };
03221 ipixel += 1;
03222 ;
03223 botRLEdata += 1 * voxel_istride;
03224 count--;
03225 SET_VOXELS_LOADED;
03226 }
03227 break;
03228 case ALL_NONZERO__BOT_NONZERO:
03229
03230
03231 if (!voxels_loaded) {
03232
03233 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03234
03235
03236 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
03237 ;
03238
03239
03240 top_rclr =
03241 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03242
03243 top_gclr =
03244 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03245
03246 top_bclr =
03247 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03248 ;
03249 ;
03250 ;
03251 shade_factor = top_opc * slice_depth_cueing;
03252
03253 top_rclr *= shade_factor;
03254 top_gclr *= shade_factor;
03255 top_bclr *= shade_factor;
03256 ;
03257
03258 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03259
03260
03261 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
03262 ;
03263
03264
03265 bot_rclr =
03266 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03267
03268 bot_gclr =
03269 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03270
03271 bot_bclr =
03272 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03273 ;
03274 ;
03275 ;
03276 shade_factor = bot_opc * slice_depth_cueing;
03277
03278 bot_rclr *= shade_factor;
03279 bot_gclr *= shade_factor;
03280 bot_bclr *= shade_factor;
03281 ;
03282 }
03283
03284 #ifdef DEBUG
03285 if (ipixel == trace_pixel_ptr) {
03286 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03287 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03288 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03289 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03290 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03291 }
03292 #endif
03293 ;
03294
03295 acc_opc = top_opc * wgtTL;
03296
03297 acc_rclr = top_rclr * wgtTL;
03298 acc_gclr = top_gclr * wgtTL;
03299 acc_bclr = top_bclr * wgtTL;
03300
03301 #ifdef DEBUG
03302 if (ipixel == trace_pixel_ptr) {
03303 trace_opcTL = top_opc;
03304 trace_rclrTL = top_rclr;
03305 trace_gclrTL = top_gclr;
03306 trace_bclrTL = top_bclr;
03307
03308 }
03309 #endif
03310 ;
03311
03312 acc_opc += bot_opc * wgtBL;
03313
03314 acc_rclr += bot_rclr * wgtBL;
03315 acc_gclr += bot_gclr * wgtBL;
03316 acc_bclr += bot_bclr * wgtBL;
03317
03318 #ifdef DEBUG
03319 if (ipixel == trace_pixel_ptr) {
03320 trace_opcBL = bot_opc;
03321 trace_rclrBL = bot_rclr;
03322 trace_gclrBL = bot_gclr;
03323 trace_bclrBL = bot_bclr;
03324
03325 }
03326 #endif
03327 ;
03328
03329 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03330
03331
03332 shade_index=1*3*ShortField(botRLEdata,norm_offset);
03333 ;
03334
03335
03336 bot_rclr =
03337 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03338
03339 bot_gclr =
03340 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03341
03342 bot_bclr =
03343 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03344 ;
03345 ;
03346 ;
03347 shade_factor = bot_opc * slice_depth_cueing;
03348
03349 bot_rclr *= shade_factor;
03350 bot_gclr *= shade_factor;
03351 bot_bclr *= shade_factor;
03352 ;
03353
03354 acc_opc += bot_opc * wgtBR;
03355
03356 acc_rclr += bot_rclr * wgtBR;
03357 acc_gclr += bot_gclr * wgtBR;
03358 acc_bclr += bot_bclr * wgtBR;
03359
03360 #ifdef DEBUG
03361 if (ipixel == trace_pixel_ptr) {
03362 trace_opcBR = bot_opc;
03363 trace_rclrBR = bot_rclr;
03364 trace_gclrBR = bot_gclr;
03365 trace_bclrBR = bot_bclr;
03366
03367 }
03368 #endif
03369 ;
03370
03371 COUNT_RESAMPLE;
03372 if (acc_opc > min_opacity) {
03373 COUNT_COMPOSITE;
03374 iopc = ipixel->opcflt;
03375 # ifndef SKIP_ERT
03376 ASSERT(iopc < max_opacity);
03377 # endif
03378 iopc_inv = (float)1. - iopc;
03379
03380 ipixel->rclrflt += acc_rclr * iopc_inv;
03381 ipixel->gclrflt += acc_gclr * iopc_inv;
03382 ipixel->bclrflt += acc_bclr * iopc_inv;
03383 iopc += acc_opc * iopc_inv;
03384 ipixel->opcflt = iopc;
03385
03386 #ifdef DEBUG
03387 if (ipixel == trace_pixel_ptr) {
03388 #ifdef COMPUTE_SHADOW_BUFFER
03389 printf("{%3d} %3d %3d", k, icount-i-count, j);
03390 #else
03391 printf("[%3d] %3d %3d", k, icount-i-count, j);
03392 #endif
03393 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03394 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03395 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03396 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03397 printf(" %3.0f %3.0f\n", iopc*255.,
03398 ipixel->rclrflt);
03399
03400
03401 printf(" ");
03402 printf(" %3.0f ",trace_gclrTL);
03403 printf(" %3.0f ",trace_gclrBL);
03404 printf(" %3.0f ",trace_gclrTR);
03405 printf(" %3.0f ",trace_gclrBR);
03406 printf(" %3.0f\n", ipixel->gclrflt);
03407 printf(" ");
03408 printf(" %3.0f ",trace_bclrTL);
03409 printf(" %3.0f ",trace_bclrBL);
03410 printf(" %3.0f ",trace_bclrTR);
03411 printf(" %3.0f ",trace_bclrBR);
03412 printf(" %3.0f\n", ipixel->bclrflt);
03413 }
03414 #endif
03415 ;
03416 # ifndef SKIP_ERT
03417 if (iopc >= max_opacity) {
03418 ASSERT(ipixel->lnk == 0);
03419 ipixel->lnk = 1;
03420 }
03421 # endif
03422 };
03423 ipixel += 1;
03424 ;
03425 botRLEdata += 1 * voxel_istride;
03426 count--;
03427 SET_VOXELS_LOADED;
03428
03429
03430
03431 while (count > 0) {
03432 if (PIXEL_IS_OPAQUE(ipixel))
03433 break;
03434 if (!voxels_loaded) {
03435
03436 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03437
03438
03439 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
03440 ;
03441
03442
03443 bot_rclr =
03444 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03445
03446 bot_gclr =
03447 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03448
03449 bot_bclr =
03450 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03451 ;
03452 ;
03453 ;
03454 shade_factor = bot_opc * slice_depth_cueing;
03455
03456 bot_rclr *= shade_factor;
03457 bot_gclr *= shade_factor;
03458 bot_bclr *= shade_factor;
03459 ;
03460 }
03461
03462 #ifdef DEBUG
03463 if (ipixel == trace_pixel_ptr) {
03464 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03465 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03466 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03467 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03468 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03469 }
03470 #endif
03471 ;
03472
03473 acc_opc = bot_opc * wgtBL;
03474
03475 acc_rclr = bot_rclr * wgtBL;
03476 acc_gclr = bot_gclr * wgtBL;
03477 acc_bclr = bot_bclr * wgtBL;
03478
03479 #ifdef DEBUG
03480 if (ipixel == trace_pixel_ptr) {
03481 trace_opcBL = bot_opc;
03482 trace_rclrBL = bot_rclr;
03483 trace_gclrBL = bot_gclr;
03484 trace_bclrBL = bot_bclr;
03485
03486 }
03487 #endif
03488 ;
03489
03490 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03491
03492
03493 shade_index=1*3*ShortField(botRLEdata,norm_offset);
03494 ;
03495
03496
03497 bot_rclr =
03498 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03499
03500 bot_gclr =
03501 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03502
03503 bot_bclr =
03504 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03505 ;
03506 ;
03507 ;
03508 shade_factor = bot_opc * slice_depth_cueing;
03509
03510 bot_rclr *= shade_factor;
03511 bot_gclr *= shade_factor;
03512 bot_bclr *= shade_factor;
03513 ;
03514
03515 acc_opc += bot_opc * wgtBR;
03516
03517 acc_rclr += bot_rclr * wgtBR;
03518 acc_gclr += bot_gclr * wgtBR;
03519 acc_bclr += bot_bclr * wgtBR;
03520
03521 #ifdef DEBUG
03522 if (ipixel == trace_pixel_ptr) {
03523 trace_opcBR = bot_opc;
03524 trace_rclrBR = bot_rclr;
03525 trace_gclrBR = bot_gclr;
03526 trace_bclrBR = bot_bclr;
03527
03528 }
03529 #endif
03530 ;
03531
03532 COUNT_RESAMPLE;
03533 if (acc_opc > min_opacity) {
03534 COUNT_COMPOSITE;
03535 iopc = ipixel->opcflt;
03536 # ifndef SKIP_ERT
03537 ASSERT(iopc < max_opacity);
03538 # endif
03539 iopc_inv = (float)1. - iopc;
03540
03541 ipixel->rclrflt += acc_rclr * iopc_inv;
03542 ipixel->gclrflt += acc_gclr * iopc_inv;
03543 ipixel->bclrflt += acc_bclr * iopc_inv;
03544 iopc += acc_opc * iopc_inv;
03545 ipixel->opcflt = iopc;
03546
03547 #ifdef DEBUG
03548 if (ipixel == trace_pixel_ptr) {
03549 #ifdef COMPUTE_SHADOW_BUFFER
03550 printf("{%3d} %3d %3d", k, icount-i-count, j);
03551 #else
03552 printf("[%3d] %3d %3d", k, icount-i-count, j);
03553 #endif
03554 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03555 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03556 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03557 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03558 printf(" %3.0f %3.0f\n", iopc*255.,
03559 ipixel->rclrflt);
03560
03561
03562 printf(" ");
03563 printf(" %3.0f ",trace_gclrTL);
03564 printf(" %3.0f ",trace_gclrBL);
03565 printf(" %3.0f ",trace_gclrTR);
03566 printf(" %3.0f ",trace_gclrBR);
03567 printf(" %3.0f\n", ipixel->gclrflt);
03568 printf(" ");
03569 printf(" %3.0f ",trace_bclrTL);
03570 printf(" %3.0f ",trace_bclrBL);
03571 printf(" %3.0f ",trace_bclrTR);
03572 printf(" %3.0f ",trace_bclrBR);
03573 printf(" %3.0f\n", ipixel->bclrflt);
03574 }
03575 #endif
03576 ;
03577 # ifndef SKIP_ERT
03578 if (iopc >= max_opacity) {
03579 ASSERT(ipixel->lnk == 0);
03580 ipixel->lnk = 1;
03581 }
03582 # endif
03583 };
03584 ipixel += 1;
03585 ;
03586 botRLEdata += 1 * voxel_istride;
03587 count--;
03588 SET_VOXELS_LOADED;
03589 }
03590 break;
03591 case ALL_ZERO__ALL_NONZERO:
03592
03593
03594 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03595
03596
03597 shade_index=1*3*ShortField(topRLEdata,norm_offset);
03598 ;
03599
03600
03601 top_rclr =
03602 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03603
03604 top_gclr =
03605 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03606
03607 top_bclr =
03608 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03609 ;
03610 ;
03611 ;
03612 shade_factor = top_opc * slice_depth_cueing;
03613
03614 top_rclr *= shade_factor;
03615 top_gclr *= shade_factor;
03616 top_bclr *= shade_factor;
03617 ;
03618
03619 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03620
03621
03622 shade_index=1*3*ShortField(botRLEdata,norm_offset);
03623 ;
03624
03625
03626 bot_rclr =
03627 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03628
03629 bot_gclr =
03630 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03631
03632 bot_bclr =
03633 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03634 ;
03635 ;
03636 ;
03637 shade_factor = bot_opc * slice_depth_cueing;
03638
03639 bot_rclr *= shade_factor;
03640 bot_gclr *= shade_factor;
03641 bot_bclr *= shade_factor;
03642 ;
03643
03644 #ifdef DEBUG
03645 if (ipixel == trace_pixel_ptr) {
03646 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03647 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03648 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03649 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03650 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03651 }
03652 #endif
03653 ;
03654
03655 acc_opc = top_opc * wgtTR;
03656
03657 acc_rclr = top_rclr * wgtTR;
03658 acc_gclr = top_gclr * wgtTR;
03659 acc_bclr = top_bclr * wgtTR;
03660
03661 #ifdef DEBUG
03662 if (ipixel == trace_pixel_ptr) {
03663 trace_opcTR = top_opc;
03664 trace_rclrTR = top_rclr;
03665 trace_gclrTR = top_gclr;
03666 trace_bclrTR = top_bclr;
03667
03668 }
03669 #endif
03670 ;
03671
03672 acc_opc += bot_opc * wgtBR;
03673
03674 acc_rclr += bot_rclr * wgtBR;
03675 acc_gclr += bot_gclr * wgtBR;
03676 acc_bclr += bot_bclr * wgtBR;
03677
03678 #ifdef DEBUG
03679 if (ipixel == trace_pixel_ptr) {
03680 trace_opcBR = bot_opc;
03681 trace_rclrBR = bot_rclr;
03682 trace_gclrBR = bot_gclr;
03683 trace_bclrBR = bot_bclr;
03684
03685 }
03686 #endif
03687 ;
03688
03689 COUNT_RESAMPLE;
03690 if (acc_opc > min_opacity) {
03691 COUNT_COMPOSITE;
03692 iopc = ipixel->opcflt;
03693 # ifndef SKIP_ERT
03694 ASSERT(iopc < max_opacity);
03695 # endif
03696 iopc_inv = (float)1. - iopc;
03697
03698 ipixel->rclrflt += acc_rclr * iopc_inv;
03699 ipixel->gclrflt += acc_gclr * iopc_inv;
03700 ipixel->bclrflt += acc_bclr * iopc_inv;
03701 iopc += acc_opc * iopc_inv;
03702 ipixel->opcflt = iopc;
03703
03704 #ifdef DEBUG
03705 if (ipixel == trace_pixel_ptr) {
03706 #ifdef COMPUTE_SHADOW_BUFFER
03707 printf("{%3d} %3d %3d", k, icount-i-count, j);
03708 #else
03709 printf("[%3d] %3d %3d", k, icount-i-count, j);
03710 #endif
03711 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03712 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03713 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03714 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03715 printf(" %3.0f %3.0f\n", iopc*255.,
03716 ipixel->rclrflt);
03717
03718
03719 printf(" ");
03720 printf(" %3.0f ",trace_gclrTL);
03721 printf(" %3.0f ",trace_gclrBL);
03722 printf(" %3.0f ",trace_gclrTR);
03723 printf(" %3.0f ",trace_gclrBR);
03724 printf(" %3.0f\n", ipixel->gclrflt);
03725 printf(" ");
03726 printf(" %3.0f ",trace_bclrTL);
03727 printf(" %3.0f ",trace_bclrBL);
03728 printf(" %3.0f ",trace_bclrTR);
03729 printf(" %3.0f ",trace_bclrBR);
03730 printf(" %3.0f\n", ipixel->bclrflt);
03731 }
03732 #endif
03733 ;
03734 # ifndef SKIP_ERT
03735 if (iopc >= max_opacity) {
03736 ASSERT(ipixel->lnk == 0);
03737 ipixel->lnk = 1;
03738 }
03739 # endif
03740 };
03741 ipixel += 1;
03742 topRLEdata += 1 * voxel_istride;
03743 botRLEdata += 1 * voxel_istride;
03744 count--;
03745 SET_VOXELS_LOADED;
03746
03747
03748
03749 while (count > 0) {
03750 if (PIXEL_IS_OPAQUE(ipixel))
03751 break;
03752 if (!voxels_loaded) {
03753
03754 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03755
03756
03757 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
03758 ;
03759
03760
03761 top_rclr =
03762 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03763
03764 top_gclr =
03765 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03766
03767 top_bclr =
03768 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03769 ;
03770 ;
03771 ;
03772 shade_factor = top_opc * slice_depth_cueing;
03773
03774 top_rclr *= shade_factor;
03775 top_gclr *= shade_factor;
03776 top_bclr *= shade_factor;
03777 ;
03778
03779 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
03780
03781
03782 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
03783 ;
03784
03785
03786 bot_rclr =
03787 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03788
03789 bot_gclr =
03790 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03791
03792 bot_bclr =
03793 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03794 ;
03795 ;
03796 ;
03797 shade_factor = bot_opc * slice_depth_cueing;
03798
03799 bot_rclr *= shade_factor;
03800 bot_gclr *= shade_factor;
03801 bot_bclr *= shade_factor;
03802 ;
03803 }
03804
03805 #ifdef DEBUG
03806 if (ipixel == trace_pixel_ptr) {
03807 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03808 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03809 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03810 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03811 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03812 }
03813 #endif
03814 ;
03815
03816 acc_opc = top_opc * wgtTL;
03817
03818 acc_rclr = top_rclr * wgtTL;
03819 acc_gclr = top_gclr * wgtTL;
03820 acc_bclr = top_bclr * wgtTL;
03821
03822 #ifdef DEBUG
03823 if (ipixel == trace_pixel_ptr) {
03824 trace_opcTL = top_opc;
03825 trace_rclrTL = top_rclr;
03826 trace_gclrTL = top_gclr;
03827 trace_bclrTL = top_bclr;
03828
03829 }
03830 #endif
03831 ;
03832
03833 acc_opc += bot_opc * wgtBL;
03834
03835 acc_rclr += bot_rclr * wgtBL;
03836 acc_gclr += bot_gclr * wgtBL;
03837 acc_bclr += bot_bclr * wgtBL;
03838
03839 #ifdef DEBUG
03840 if (ipixel == trace_pixel_ptr) {
03841 trace_opcBL = bot_opc;
03842 trace_rclrBL = bot_rclr;
03843 trace_gclrBL = bot_gclr;
03844 trace_bclrBL = bot_bclr;
03845
03846 }
03847 #endif
03848 ;
03849
03850 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
03851
03852
03853 shade_index=1*3*ShortField(topRLEdata,norm_offset);
03854 ;
03855
03856
03857 top_rclr =
03858 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03859
03860 top_gclr =
03861 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03862
03863 top_bclr =
03864 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03865 ;
03866 ;
03867 ;
03868 shade_factor = top_opc * slice_depth_cueing;
03869
03870 top_rclr *= shade_factor;
03871 top_gclr *= shade_factor;
03872 top_bclr *= shade_factor;
03873 ;
03874
03875 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
03876
03877
03878 shade_index=1*3*ShortField(botRLEdata,norm_offset);
03879 ;
03880
03881
03882 bot_rclr =
03883 shade_table[shade_index + 3*0 + 0] * (float)1.0;
03884
03885 bot_gclr =
03886 shade_table[shade_index + 3*0 + 1] * (float)1.0;
03887
03888 bot_bclr =
03889 shade_table[shade_index + 3*0 + 2] * (float)1.0;
03890 ;
03891 ;
03892 ;
03893 shade_factor = bot_opc * slice_depth_cueing;
03894
03895 bot_rclr *= shade_factor;
03896 bot_gclr *= shade_factor;
03897 bot_bclr *= shade_factor;
03898 ;
03899
03900 acc_opc += top_opc * wgtTR;
03901
03902 acc_rclr += top_rclr * wgtTR;
03903 acc_gclr += top_gclr * wgtTR;
03904 acc_bclr += top_bclr * wgtTR;
03905
03906 #ifdef DEBUG
03907 if (ipixel == trace_pixel_ptr) {
03908 trace_opcTR = top_opc;
03909 trace_rclrTR = top_rclr;
03910 trace_gclrTR = top_gclr;
03911 trace_bclrTR = top_bclr;
03912
03913 }
03914 #endif
03915 ;
03916
03917 acc_opc += bot_opc * wgtBR;
03918
03919 acc_rclr += bot_rclr * wgtBR;
03920 acc_gclr += bot_gclr * wgtBR;
03921 acc_bclr += bot_bclr * wgtBR;
03922
03923 #ifdef DEBUG
03924 if (ipixel == trace_pixel_ptr) {
03925 trace_opcBR = bot_opc;
03926 trace_rclrBR = bot_rclr;
03927 trace_gclrBR = bot_gclr;
03928 trace_bclrBR = bot_bclr;
03929
03930 }
03931 #endif
03932 ;
03933
03934 COUNT_RESAMPLE;
03935 if (acc_opc > min_opacity) {
03936 COUNT_COMPOSITE;
03937 iopc = ipixel->opcflt;
03938 # ifndef SKIP_ERT
03939 ASSERT(iopc < max_opacity);
03940 # endif
03941 iopc_inv = (float)1. - iopc;
03942
03943 ipixel->rclrflt += acc_rclr * iopc_inv;
03944 ipixel->gclrflt += acc_gclr * iopc_inv;
03945 ipixel->bclrflt += acc_bclr * iopc_inv;
03946 iopc += acc_opc * iopc_inv;
03947 ipixel->opcflt = iopc;
03948
03949 #ifdef DEBUG
03950 if (ipixel == trace_pixel_ptr) {
03951 #ifdef COMPUTE_SHADOW_BUFFER
03952 printf("{%3d} %3d %3d", k, icount-i-count, j);
03953 #else
03954 printf("[%3d] %3d %3d", k, icount-i-count, j);
03955 #endif
03956 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03957 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03958 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03959 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03960 printf(" %3.0f %3.0f\n", iopc*255.,
03961 ipixel->rclrflt);
03962
03963
03964 printf(" ");
03965 printf(" %3.0f ",trace_gclrTL);
03966 printf(" %3.0f ",trace_gclrBL);
03967 printf(" %3.0f ",trace_gclrTR);
03968 printf(" %3.0f ",trace_gclrBR);
03969 printf(" %3.0f\n", ipixel->gclrflt);
03970 printf(" ");
03971 printf(" %3.0f ",trace_bclrTL);
03972 printf(" %3.0f ",trace_bclrBL);
03973 printf(" %3.0f ",trace_bclrTR);
03974 printf(" %3.0f ",trace_bclrBR);
03975 printf(" %3.0f\n", ipixel->bclrflt);
03976 }
03977 #endif
03978 ;
03979 # ifndef SKIP_ERT
03980 if (iopc >= max_opacity) {
03981 ASSERT(ipixel->lnk == 0);
03982 ipixel->lnk = 1;
03983 }
03984 # endif
03985 };
03986 ipixel += 1;
03987 topRLEdata += 1 * voxel_istride;
03988 botRLEdata += 1 * voxel_istride;
03989 count--;
03990 SET_VOXELS_LOADED;
03991 }
03992 break;
03993 case TOP_NONZERO__ALL_NONZERO:
03994
03995
03996 if (!voxels_loaded) {
03997
03998 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
03999
04000
04001 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
04002 ;
04003
04004
04005 top_rclr =
04006 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04007
04008 top_gclr =
04009 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04010
04011 top_bclr =
04012 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04013 ;
04014 ;
04015 ;
04016 shade_factor = top_opc * slice_depth_cueing;
04017
04018 top_rclr *= shade_factor;
04019 top_gclr *= shade_factor;
04020 top_bclr *= shade_factor;
04021 ;
04022 }
04023
04024 #ifdef DEBUG
04025 if (ipixel == trace_pixel_ptr) {
04026 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04027 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04028 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04029 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04030 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04031 }
04032 #endif
04033 ;
04034
04035 acc_opc = top_opc * wgtTL;
04036
04037 acc_rclr = top_rclr * wgtTL;
04038 acc_gclr = top_gclr * wgtTL;
04039 acc_bclr = top_bclr * wgtTL;
04040
04041 #ifdef DEBUG
04042 if (ipixel == trace_pixel_ptr) {
04043 trace_opcTL = top_opc;
04044 trace_rclrTL = top_rclr;
04045 trace_gclrTL = top_gclr;
04046 trace_bclrTL = top_bclr;
04047
04048 }
04049 #endif
04050 ;
04051
04052 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04053
04054
04055 shade_index=1*3*ShortField(topRLEdata,norm_offset);
04056 ;
04057
04058
04059 top_rclr =
04060 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04061
04062 top_gclr =
04063 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04064
04065 top_bclr =
04066 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04067 ;
04068 ;
04069 ;
04070 shade_factor = top_opc * slice_depth_cueing;
04071
04072 top_rclr *= shade_factor;
04073 top_gclr *= shade_factor;
04074 top_bclr *= shade_factor;
04075 ;
04076
04077 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04078
04079
04080 shade_index=1*3*ShortField(botRLEdata,norm_offset);
04081 ;
04082
04083
04084 bot_rclr =
04085 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04086
04087 bot_gclr =
04088 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04089
04090 bot_bclr =
04091 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04092 ;
04093 ;
04094 ;
04095 shade_factor = bot_opc * slice_depth_cueing;
04096
04097 bot_rclr *= shade_factor;
04098 bot_gclr *= shade_factor;
04099 bot_bclr *= shade_factor;
04100 ;
04101
04102 acc_opc += top_opc * wgtTR;
04103
04104 acc_rclr += top_rclr * wgtTR;
04105 acc_gclr += top_gclr * wgtTR;
04106 acc_bclr += top_bclr * wgtTR;
04107
04108 #ifdef DEBUG
04109 if (ipixel == trace_pixel_ptr) {
04110 trace_opcTR = top_opc;
04111 trace_rclrTR = top_rclr;
04112 trace_gclrTR = top_gclr;
04113 trace_bclrTR = top_bclr;
04114
04115 }
04116 #endif
04117 ;
04118
04119 acc_opc += bot_opc * wgtBR;
04120
04121 acc_rclr += bot_rclr * wgtBR;
04122 acc_gclr += bot_gclr * wgtBR;
04123 acc_bclr += bot_bclr * wgtBR;
04124
04125 #ifdef DEBUG
04126 if (ipixel == trace_pixel_ptr) {
04127 trace_opcBR = bot_opc;
04128 trace_rclrBR = bot_rclr;
04129 trace_gclrBR = bot_gclr;
04130 trace_bclrBR = bot_bclr;
04131
04132 }
04133 #endif
04134 ;
04135
04136 COUNT_RESAMPLE;
04137 if (acc_opc > min_opacity) {
04138 COUNT_COMPOSITE;
04139 iopc = ipixel->opcflt;
04140 # ifndef SKIP_ERT
04141 ASSERT(iopc < max_opacity);
04142 # endif
04143 iopc_inv = (float)1. - iopc;
04144
04145 ipixel->rclrflt += acc_rclr * iopc_inv;
04146 ipixel->gclrflt += acc_gclr * iopc_inv;
04147 ipixel->bclrflt += acc_bclr * iopc_inv;
04148 iopc += acc_opc * iopc_inv;
04149 ipixel->opcflt = iopc;
04150
04151 #ifdef DEBUG
04152 if (ipixel == trace_pixel_ptr) {
04153 #ifdef COMPUTE_SHADOW_BUFFER
04154 printf("{%3d} %3d %3d", k, icount-i-count, j);
04155 #else
04156 printf("[%3d] %3d %3d", k, icount-i-count, j);
04157 #endif
04158 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04159 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04160 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04161 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04162 printf(" %3.0f %3.0f\n", iopc*255.,
04163 ipixel->rclrflt);
04164
04165
04166 printf(" ");
04167 printf(" %3.0f ",trace_gclrTL);
04168 printf(" %3.0f ",trace_gclrBL);
04169 printf(" %3.0f ",trace_gclrTR);
04170 printf(" %3.0f ",trace_gclrBR);
04171 printf(" %3.0f\n", ipixel->gclrflt);
04172 printf(" ");
04173 printf(" %3.0f ",trace_bclrTL);
04174 printf(" %3.0f ",trace_bclrBL);
04175 printf(" %3.0f ",trace_bclrTR);
04176 printf(" %3.0f ",trace_bclrBR);
04177 printf(" %3.0f\n", ipixel->bclrflt);
04178 }
04179 #endif
04180 ;
04181 # ifndef SKIP_ERT
04182 if (iopc >= max_opacity) {
04183 ASSERT(ipixel->lnk == 0);
04184 ipixel->lnk = 1;
04185 }
04186 # endif
04187 };
04188 ipixel += 1;
04189 topRLEdata += 1 * voxel_istride;
04190 botRLEdata += 1 * voxel_istride;
04191 count--;
04192 SET_VOXELS_LOADED;
04193
04194
04195
04196 while (count > 0) {
04197 if (PIXEL_IS_OPAQUE(ipixel))
04198 break;
04199 if (!voxels_loaded) {
04200
04201 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04202
04203
04204 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
04205 ;
04206
04207
04208 top_rclr =
04209 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04210
04211 top_gclr =
04212 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04213
04214 top_bclr =
04215 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04216 ;
04217 ;
04218 ;
04219 shade_factor = top_opc * slice_depth_cueing;
04220
04221 top_rclr *= shade_factor;
04222 top_gclr *= shade_factor;
04223 top_bclr *= shade_factor;
04224 ;
04225
04226 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04227
04228
04229 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
04230 ;
04231
04232
04233 bot_rclr =
04234 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04235
04236 bot_gclr =
04237 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04238
04239 bot_bclr =
04240 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04241 ;
04242 ;
04243 ;
04244 shade_factor = bot_opc * slice_depth_cueing;
04245
04246 bot_rclr *= shade_factor;
04247 bot_gclr *= shade_factor;
04248 bot_bclr *= shade_factor;
04249 ;
04250 }
04251
04252 #ifdef DEBUG
04253 if (ipixel == trace_pixel_ptr) {
04254 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04255 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04256 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04257 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04258 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04259 }
04260 #endif
04261 ;
04262
04263 acc_opc = top_opc * wgtTL;
04264
04265 acc_rclr = top_rclr * wgtTL;
04266 acc_gclr = top_gclr * wgtTL;
04267 acc_bclr = top_bclr * wgtTL;
04268
04269 #ifdef DEBUG
04270 if (ipixel == trace_pixel_ptr) {
04271 trace_opcTL = top_opc;
04272 trace_rclrTL = top_rclr;
04273 trace_gclrTL = top_gclr;
04274 trace_bclrTL = top_bclr;
04275
04276 }
04277 #endif
04278 ;
04279
04280 acc_opc += bot_opc * wgtBL;
04281
04282 acc_rclr += bot_rclr * wgtBL;
04283 acc_gclr += bot_gclr * wgtBL;
04284 acc_bclr += bot_bclr * wgtBL;
04285
04286 #ifdef DEBUG
04287 if (ipixel == trace_pixel_ptr) {
04288 trace_opcBL = bot_opc;
04289 trace_rclrBL = bot_rclr;
04290 trace_gclrBL = bot_gclr;
04291 trace_bclrBL = bot_bclr;
04292
04293 }
04294 #endif
04295 ;
04296
04297 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04298
04299
04300 shade_index=1*3*ShortField(topRLEdata,norm_offset);
04301 ;
04302
04303
04304 top_rclr =
04305 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04306
04307 top_gclr =
04308 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04309
04310 top_bclr =
04311 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04312 ;
04313 ;
04314 ;
04315 shade_factor = top_opc * slice_depth_cueing;
04316
04317 top_rclr *= shade_factor;
04318 top_gclr *= shade_factor;
04319 top_bclr *= shade_factor;
04320 ;
04321
04322 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04323
04324
04325 shade_index=1*3*ShortField(botRLEdata,norm_offset);
04326 ;
04327
04328
04329 bot_rclr =
04330 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04331
04332 bot_gclr =
04333 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04334
04335 bot_bclr =
04336 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04337 ;
04338 ;
04339 ;
04340 shade_factor = bot_opc * slice_depth_cueing;
04341
04342 bot_rclr *= shade_factor;
04343 bot_gclr *= shade_factor;
04344 bot_bclr *= shade_factor;
04345 ;
04346
04347 acc_opc += top_opc * wgtTR;
04348
04349 acc_rclr += top_rclr * wgtTR;
04350 acc_gclr += top_gclr * wgtTR;
04351 acc_bclr += top_bclr * wgtTR;
04352
04353 #ifdef DEBUG
04354 if (ipixel == trace_pixel_ptr) {
04355 trace_opcTR = top_opc;
04356 trace_rclrTR = top_rclr;
04357 trace_gclrTR = top_gclr;
04358 trace_bclrTR = top_bclr;
04359
04360 }
04361 #endif
04362 ;
04363
04364 acc_opc += bot_opc * wgtBR;
04365
04366 acc_rclr += bot_rclr * wgtBR;
04367 acc_gclr += bot_gclr * wgtBR;
04368 acc_bclr += bot_bclr * wgtBR;
04369
04370 #ifdef DEBUG
04371 if (ipixel == trace_pixel_ptr) {
04372 trace_opcBR = bot_opc;
04373 trace_rclrBR = bot_rclr;
04374 trace_gclrBR = bot_gclr;
04375 trace_bclrBR = bot_bclr;
04376
04377 }
04378 #endif
04379 ;
04380
04381 COUNT_RESAMPLE;
04382 if (acc_opc > min_opacity) {
04383 COUNT_COMPOSITE;
04384 iopc = ipixel->opcflt;
04385 # ifndef SKIP_ERT
04386 ASSERT(iopc < max_opacity);
04387 # endif
04388 iopc_inv = (float)1. - iopc;
04389
04390 ipixel->rclrflt += acc_rclr * iopc_inv;
04391 ipixel->gclrflt += acc_gclr * iopc_inv;
04392 ipixel->bclrflt += acc_bclr * iopc_inv;
04393 iopc += acc_opc * iopc_inv;
04394 ipixel->opcflt = iopc;
04395
04396 #ifdef DEBUG
04397 if (ipixel == trace_pixel_ptr) {
04398 #ifdef COMPUTE_SHADOW_BUFFER
04399 printf("{%3d} %3d %3d", k, icount-i-count, j);
04400 #else
04401 printf("[%3d] %3d %3d", k, icount-i-count, j);
04402 #endif
04403 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04404 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04405 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04406 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04407 printf(" %3.0f %3.0f\n", iopc*255.,
04408 ipixel->rclrflt);
04409
04410
04411 printf(" ");
04412 printf(" %3.0f ",trace_gclrTL);
04413 printf(" %3.0f ",trace_gclrBL);
04414 printf(" %3.0f ",trace_gclrTR);
04415 printf(" %3.0f ",trace_gclrBR);
04416 printf(" %3.0f\n", ipixel->gclrflt);
04417 printf(" ");
04418 printf(" %3.0f ",trace_bclrTL);
04419 printf(" %3.0f ",trace_bclrBL);
04420 printf(" %3.0f ",trace_bclrTR);
04421 printf(" %3.0f ",trace_bclrBR);
04422 printf(" %3.0f\n", ipixel->bclrflt);
04423 }
04424 #endif
04425 ;
04426 # ifndef SKIP_ERT
04427 if (iopc >= max_opacity) {
04428 ASSERT(ipixel->lnk == 0);
04429 ipixel->lnk = 1;
04430 }
04431 # endif
04432 };
04433 ipixel += 1;
04434 topRLEdata += 1 * voxel_istride;
04435 botRLEdata += 1 * voxel_istride;
04436 count--;
04437 SET_VOXELS_LOADED;
04438 }
04439 break;
04440 case BOT_NONZERO__ALL_NONZERO:
04441
04442
04443 if (!voxels_loaded) {
04444
04445 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04446
04447
04448 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
04449 ;
04450
04451
04452 bot_rclr =
04453 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04454
04455 bot_gclr =
04456 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04457
04458 bot_bclr =
04459 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04460 ;
04461 ;
04462 ;
04463 shade_factor = bot_opc * slice_depth_cueing;
04464
04465 bot_rclr *= shade_factor;
04466 bot_gclr *= shade_factor;
04467 bot_bclr *= shade_factor;
04468 ;
04469 }
04470
04471 #ifdef DEBUG
04472 if (ipixel == trace_pixel_ptr) {
04473 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04474 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04475 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04476 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04477 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04478 }
04479 #endif
04480 ;
04481
04482 acc_opc = bot_opc * wgtBL;
04483
04484 acc_rclr = bot_rclr * wgtBL;
04485 acc_gclr = bot_gclr * wgtBL;
04486 acc_bclr = bot_bclr * wgtBL;
04487
04488 #ifdef DEBUG
04489 if (ipixel == trace_pixel_ptr) {
04490 trace_opcBL = bot_opc;
04491 trace_rclrBL = bot_rclr;
04492 trace_gclrBL = bot_gclr;
04493 trace_bclrBL = bot_bclr;
04494
04495 }
04496 #endif
04497 ;
04498
04499 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04500
04501
04502 shade_index=1*3*ShortField(topRLEdata,norm_offset);
04503 ;
04504
04505
04506 top_rclr =
04507 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04508
04509 top_gclr =
04510 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04511
04512 top_bclr =
04513 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04514 ;
04515 ;
04516 ;
04517 shade_factor = top_opc * slice_depth_cueing;
04518
04519 top_rclr *= shade_factor;
04520 top_gclr *= shade_factor;
04521 top_bclr *= shade_factor;
04522 ;
04523
04524 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04525
04526
04527 shade_index=1*3*ShortField(botRLEdata,norm_offset);
04528 ;
04529
04530
04531 bot_rclr =
04532 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04533
04534 bot_gclr =
04535 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04536
04537 bot_bclr =
04538 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04539 ;
04540 ;
04541 ;
04542 shade_factor = bot_opc * slice_depth_cueing;
04543
04544 bot_rclr *= shade_factor;
04545 bot_gclr *= shade_factor;
04546 bot_bclr *= shade_factor;
04547 ;
04548
04549 acc_opc += top_opc * wgtTR;
04550
04551 acc_rclr += top_rclr * wgtTR;
04552 acc_gclr += top_gclr * wgtTR;
04553 acc_bclr += top_bclr * wgtTR;
04554
04555 #ifdef DEBUG
04556 if (ipixel == trace_pixel_ptr) {
04557 trace_opcTR = top_opc;
04558 trace_rclrTR = top_rclr;
04559 trace_gclrTR = top_gclr;
04560 trace_bclrTR = top_bclr;
04561
04562 }
04563 #endif
04564 ;
04565
04566 acc_opc += bot_opc * wgtBR;
04567
04568 acc_rclr += bot_rclr * wgtBR;
04569 acc_gclr += bot_gclr * wgtBR;
04570 acc_bclr += bot_bclr * wgtBR;
04571
04572 #ifdef DEBUG
04573 if (ipixel == trace_pixel_ptr) {
04574 trace_opcBR = bot_opc;
04575 trace_rclrBR = bot_rclr;
04576 trace_gclrBR = bot_gclr;
04577 trace_bclrBR = bot_bclr;
04578
04579 }
04580 #endif
04581 ;
04582
04583 COUNT_RESAMPLE;
04584 if (acc_opc > min_opacity) {
04585 COUNT_COMPOSITE;
04586 iopc = ipixel->opcflt;
04587 # ifndef SKIP_ERT
04588 ASSERT(iopc < max_opacity);
04589 # endif
04590 iopc_inv = (float)1. - iopc;
04591
04592 ipixel->rclrflt += acc_rclr * iopc_inv;
04593 ipixel->gclrflt += acc_gclr * iopc_inv;
04594 ipixel->bclrflt += acc_bclr * iopc_inv;
04595 iopc += acc_opc * iopc_inv;
04596 ipixel->opcflt = iopc;
04597
04598 #ifdef DEBUG
04599 if (ipixel == trace_pixel_ptr) {
04600 #ifdef COMPUTE_SHADOW_BUFFER
04601 printf("{%3d} %3d %3d", k, icount-i-count, j);
04602 #else
04603 printf("[%3d] %3d %3d", k, icount-i-count, j);
04604 #endif
04605 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04606 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04607 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04608 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04609 printf(" %3.0f %3.0f\n", iopc*255.,
04610 ipixel->rclrflt);
04611
04612
04613 printf(" ");
04614 printf(" %3.0f ",trace_gclrTL);
04615 printf(" %3.0f ",trace_gclrBL);
04616 printf(" %3.0f ",trace_gclrTR);
04617 printf(" %3.0f ",trace_gclrBR);
04618 printf(" %3.0f\n", ipixel->gclrflt);
04619 printf(" ");
04620 printf(" %3.0f ",trace_bclrTL);
04621 printf(" %3.0f ",trace_bclrBL);
04622 printf(" %3.0f ",trace_bclrTR);
04623 printf(" %3.0f ",trace_bclrBR);
04624 printf(" %3.0f\n", ipixel->bclrflt);
04625 }
04626 #endif
04627 ;
04628 # ifndef SKIP_ERT
04629 if (iopc >= max_opacity) {
04630 ASSERT(ipixel->lnk == 0);
04631 ipixel->lnk = 1;
04632 }
04633 # endif
04634 };
04635 ipixel += 1;
04636 topRLEdata += 1 * voxel_istride;
04637 botRLEdata += 1 * voxel_istride;
04638 count--;
04639 SET_VOXELS_LOADED;
04640
04641
04642
04643 while (count > 0) {
04644 if (PIXEL_IS_OPAQUE(ipixel))
04645 break;
04646 if (!voxels_loaded) {
04647
04648 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04649
04650
04651 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
04652 ;
04653
04654
04655 top_rclr =
04656 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04657
04658 top_gclr =
04659 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04660
04661 top_bclr =
04662 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04663 ;
04664 ;
04665 ;
04666 shade_factor = top_opc * slice_depth_cueing;
04667
04668 top_rclr *= shade_factor;
04669 top_gclr *= shade_factor;
04670 top_bclr *= shade_factor;
04671 ;
04672
04673 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04674
04675
04676 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
04677 ;
04678
04679
04680 bot_rclr =
04681 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04682
04683 bot_gclr =
04684 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04685
04686 bot_bclr =
04687 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04688 ;
04689 ;
04690 ;
04691 shade_factor = bot_opc * slice_depth_cueing;
04692
04693 bot_rclr *= shade_factor;
04694 bot_gclr *= shade_factor;
04695 bot_bclr *= shade_factor;
04696 ;
04697 }
04698
04699 #ifdef DEBUG
04700 if (ipixel == trace_pixel_ptr) {
04701 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04702 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04703 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04704 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04705 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04706 }
04707 #endif
04708 ;
04709
04710 acc_opc = top_opc * wgtTL;
04711
04712 acc_rclr = top_rclr * wgtTL;
04713 acc_gclr = top_gclr * wgtTL;
04714 acc_bclr = top_bclr * wgtTL;
04715
04716 #ifdef DEBUG
04717 if (ipixel == trace_pixel_ptr) {
04718 trace_opcTL = top_opc;
04719 trace_rclrTL = top_rclr;
04720 trace_gclrTL = top_gclr;
04721 trace_bclrTL = top_bclr;
04722
04723 }
04724 #endif
04725 ;
04726
04727 acc_opc += bot_opc * wgtBL;
04728
04729 acc_rclr += bot_rclr * wgtBL;
04730 acc_gclr += bot_gclr * wgtBL;
04731 acc_bclr += bot_bclr * wgtBL;
04732
04733 #ifdef DEBUG
04734 if (ipixel == trace_pixel_ptr) {
04735 trace_opcBL = bot_opc;
04736 trace_rclrBL = bot_rclr;
04737 trace_gclrBL = bot_gclr;
04738 trace_bclrBL = bot_bclr;
04739
04740 }
04741 #endif
04742 ;
04743
04744 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04745
04746
04747 shade_index=1*3*ShortField(topRLEdata,norm_offset);
04748 ;
04749
04750
04751 top_rclr =
04752 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04753
04754 top_gclr =
04755 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04756
04757 top_bclr =
04758 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04759 ;
04760 ;
04761 ;
04762 shade_factor = top_opc * slice_depth_cueing;
04763
04764 top_rclr *= shade_factor;
04765 top_gclr *= shade_factor;
04766 top_bclr *= shade_factor;
04767 ;
04768
04769 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
04770
04771
04772 shade_index=1*3*ShortField(botRLEdata,norm_offset);
04773 ;
04774
04775
04776 bot_rclr =
04777 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04778
04779 bot_gclr =
04780 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04781
04782 bot_bclr =
04783 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04784 ;
04785 ;
04786 ;
04787 shade_factor = bot_opc * slice_depth_cueing;
04788
04789 bot_rclr *= shade_factor;
04790 bot_gclr *= shade_factor;
04791 bot_bclr *= shade_factor;
04792 ;
04793
04794 acc_opc += top_opc * wgtTR;
04795
04796 acc_rclr += top_rclr * wgtTR;
04797 acc_gclr += top_gclr * wgtTR;
04798 acc_bclr += top_bclr * wgtTR;
04799
04800 #ifdef DEBUG
04801 if (ipixel == trace_pixel_ptr) {
04802 trace_opcTR = top_opc;
04803 trace_rclrTR = top_rclr;
04804 trace_gclrTR = top_gclr;
04805 trace_bclrTR = top_bclr;
04806
04807 }
04808 #endif
04809 ;
04810
04811 acc_opc += bot_opc * wgtBR;
04812
04813 acc_rclr += bot_rclr * wgtBR;
04814 acc_gclr += bot_gclr * wgtBR;
04815 acc_bclr += bot_bclr * wgtBR;
04816
04817 #ifdef DEBUG
04818 if (ipixel == trace_pixel_ptr) {
04819 trace_opcBR = bot_opc;
04820 trace_rclrBR = bot_rclr;
04821 trace_gclrBR = bot_gclr;
04822 trace_bclrBR = bot_bclr;
04823
04824 }
04825 #endif
04826 ;
04827
04828 COUNT_RESAMPLE;
04829 if (acc_opc > min_opacity) {
04830 COUNT_COMPOSITE;
04831 iopc = ipixel->opcflt;
04832 # ifndef SKIP_ERT
04833 ASSERT(iopc < max_opacity);
04834 # endif
04835 iopc_inv = (float)1. - iopc;
04836
04837 ipixel->rclrflt += acc_rclr * iopc_inv;
04838 ipixel->gclrflt += acc_gclr * iopc_inv;
04839 ipixel->bclrflt += acc_bclr * iopc_inv;
04840 iopc += acc_opc * iopc_inv;
04841 ipixel->opcflt = iopc;
04842
04843 #ifdef DEBUG
04844 if (ipixel == trace_pixel_ptr) {
04845 #ifdef COMPUTE_SHADOW_BUFFER
04846 printf("{%3d} %3d %3d", k, icount-i-count, j);
04847 #else
04848 printf("[%3d] %3d %3d", k, icount-i-count, j);
04849 #endif
04850 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04851 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04852 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04853 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04854 printf(" %3.0f %3.0f\n", iopc*255.,
04855 ipixel->rclrflt);
04856
04857
04858 printf(" ");
04859 printf(" %3.0f ",trace_gclrTL);
04860 printf(" %3.0f ",trace_gclrBL);
04861 printf(" %3.0f ",trace_gclrTR);
04862 printf(" %3.0f ",trace_gclrBR);
04863 printf(" %3.0f\n", ipixel->gclrflt);
04864 printf(" ");
04865 printf(" %3.0f ",trace_bclrTL);
04866 printf(" %3.0f ",trace_bclrBL);
04867 printf(" %3.0f ",trace_bclrTR);
04868 printf(" %3.0f ",trace_bclrBR);
04869 printf(" %3.0f\n", ipixel->bclrflt);
04870 }
04871 #endif
04872 ;
04873 # ifndef SKIP_ERT
04874 if (iopc >= max_opacity) {
04875 ASSERT(ipixel->lnk == 0);
04876 ipixel->lnk = 1;
04877 }
04878 # endif
04879 };
04880 ipixel += 1;
04881 topRLEdata += 1 * voxel_istride;
04882 botRLEdata += 1 * voxel_istride;
04883 count--;
04884 SET_VOXELS_LOADED;
04885 }
04886 break;
04887 case ALL_NONZERO__ALL_NONZERO:
04888
04889 while (count > 0) {
04890 if (PIXEL_IS_OPAQUE(ipixel))
04891 break;
04892 if (!voxels_loaded) {
04893
04894 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
04895
04896
04897 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
04898 ;
04899
04900
04901 top_rclr =
04902 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04903
04904 top_gclr =
04905 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04906
04907 top_bclr =
04908 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04909 ;
04910 ;
04911 ;
04912 shade_factor = top_opc * slice_depth_cueing;
04913
04914 top_rclr *= shade_factor;
04915 top_gclr *= shade_factor;
04916 top_bclr *= shade_factor;
04917 ;
04918
04919 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
04920
04921
04922 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
04923 ;
04924
04925
04926 bot_rclr =
04927 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04928
04929 bot_gclr =
04930 shade_table[shade_index + 3*0 + 1] * (float)1.0;
04931
04932 bot_bclr =
04933 shade_table[shade_index + 3*0 + 2] * (float)1.0;
04934 ;
04935 ;
04936 ;
04937 shade_factor = bot_opc * slice_depth_cueing;
04938
04939 bot_rclr *= shade_factor;
04940 bot_gclr *= shade_factor;
04941 bot_bclr *= shade_factor;
04942 ;
04943 }
04944
04945 #ifdef DEBUG
04946 if (ipixel == trace_pixel_ptr) {
04947 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04948 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04949 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04950 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04951 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04952 }
04953 #endif
04954 ;
04955
04956 acc_opc = top_opc * wgtTL;
04957
04958 acc_rclr = top_rclr * wgtTL;
04959 acc_gclr = top_gclr * wgtTL;
04960 acc_bclr = top_bclr * wgtTL;
04961
04962 #ifdef DEBUG
04963 if (ipixel == trace_pixel_ptr) {
04964 trace_opcTL = top_opc;
04965 trace_rclrTL = top_rclr;
04966 trace_gclrTL = top_gclr;
04967 trace_bclrTL = top_bclr;
04968
04969 }
04970 #endif
04971 ;
04972
04973 acc_opc += bot_opc * wgtBL;
04974
04975 acc_rclr += bot_rclr * wgtBL;
04976 acc_gclr += bot_gclr * wgtBL;
04977 acc_bclr += bot_bclr * wgtBL;
04978
04979 #ifdef DEBUG
04980 if (ipixel == trace_pixel_ptr) {
04981 trace_opcBL = bot_opc;
04982 trace_rclrBL = bot_rclr;
04983 trace_gclrBL = bot_gclr;
04984 trace_bclrBL = bot_bclr;
04985
04986 }
04987 #endif
04988 ;
04989
04990 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
04991
04992
04993 shade_index=1*3*ShortField(topRLEdata,norm_offset);
04994 ;
04995
04996
04997 top_rclr =
04998 shade_table[shade_index + 3*0 + 0] * (float)1.0;
04999
05000 top_gclr =
05001 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05002
05003 top_bclr =
05004 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05005 ;
05006 ;
05007 ;
05008 shade_factor = top_opc * slice_depth_cueing;
05009
05010 top_rclr *= shade_factor;
05011 top_gclr *= shade_factor;
05012 top_bclr *= shade_factor;
05013 ;
05014
05015 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
05016
05017
05018 shade_index=1*3*ShortField(botRLEdata,norm_offset);
05019 ;
05020
05021
05022 bot_rclr =
05023 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05024
05025 bot_gclr =
05026 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05027
05028 bot_bclr =
05029 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05030 ;
05031 ;
05032 ;
05033 shade_factor = bot_opc * slice_depth_cueing;
05034
05035 bot_rclr *= shade_factor;
05036 bot_gclr *= shade_factor;
05037 bot_bclr *= shade_factor;
05038 ;
05039
05040 acc_opc += top_opc * wgtTR;
05041
05042 acc_rclr += top_rclr * wgtTR;
05043 acc_gclr += top_gclr * wgtTR;
05044 acc_bclr += top_bclr * wgtTR;
05045
05046 #ifdef DEBUG
05047 if (ipixel == trace_pixel_ptr) {
05048 trace_opcTR = top_opc;
05049 trace_rclrTR = top_rclr;
05050 trace_gclrTR = top_gclr;
05051 trace_bclrTR = top_bclr;
05052
05053 }
05054 #endif
05055 ;
05056
05057 acc_opc += bot_opc * wgtBR;
05058
05059 acc_rclr += bot_rclr * wgtBR;
05060 acc_gclr += bot_gclr * wgtBR;
05061 acc_bclr += bot_bclr * wgtBR;
05062
05063 #ifdef DEBUG
05064 if (ipixel == trace_pixel_ptr) {
05065 trace_opcBR = bot_opc;
05066 trace_rclrBR = bot_rclr;
05067 trace_gclrBR = bot_gclr;
05068 trace_bclrBR = bot_bclr;
05069
05070 }
05071 #endif
05072 ;
05073
05074 COUNT_RESAMPLE;
05075 if (acc_opc > min_opacity) {
05076 COUNT_COMPOSITE;
05077 iopc = ipixel->opcflt;
05078 # ifndef SKIP_ERT
05079 ASSERT(iopc < max_opacity);
05080 # endif
05081 iopc_inv = (float)1. - iopc;
05082
05083 ipixel->rclrflt += acc_rclr * iopc_inv;
05084 ipixel->gclrflt += acc_gclr * iopc_inv;
05085 ipixel->bclrflt += acc_bclr * iopc_inv;
05086 iopc += acc_opc * iopc_inv;
05087 ipixel->opcflt = iopc;
05088
05089 #ifdef DEBUG
05090 if (ipixel == trace_pixel_ptr) {
05091 #ifdef COMPUTE_SHADOW_BUFFER
05092 printf("{%3d} %3d %3d", k, icount-i-count, j);
05093 #else
05094 printf("[%3d] %3d %3d", k, icount-i-count, j);
05095 #endif
05096 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05097 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05098 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05099 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05100 printf(" %3.0f %3.0f\n", iopc*255.,
05101 ipixel->rclrflt);
05102
05103
05104 printf(" ");
05105 printf(" %3.0f ",trace_gclrTL);
05106 printf(" %3.0f ",trace_gclrBL);
05107 printf(" %3.0f ",trace_gclrTR);
05108 printf(" %3.0f ",trace_gclrBR);
05109 printf(" %3.0f\n", ipixel->gclrflt);
05110 printf(" ");
05111 printf(" %3.0f ",trace_bclrTL);
05112 printf(" %3.0f ",trace_bclrBL);
05113 printf(" %3.0f ",trace_bclrTR);
05114 printf(" %3.0f ",trace_bclrBR);
05115 printf(" %3.0f\n", ipixel->bclrflt);
05116 }
05117 #endif
05118 ;
05119 # ifndef SKIP_ERT
05120 if (iopc >= max_opacity) {
05121 ASSERT(ipixel->lnk == 0);
05122 ipixel->lnk = 1;
05123 }
05124 # endif
05125 };
05126 ipixel += 1;
05127 topRLEdata += 1 * voxel_istride;
05128 botRLEdata += 1 * voxel_istride;
05129 count--;
05130 SET_VOXELS_LOADED;
05131 }
05132 break;
05133 default:
05134 VPBug("illegal value for run states in compositing loop");
05135 }
05136 #else
05137
05138 while (count > 0) {
05139 if (last_run_state == ALL_ZERO && run_state == ALL_ZERO) {
05140 ipixel += count;
05141 if (i != -1) {
05142 ;
05143 ;
05144 }
05145 count = 0;
05146 break;
05147 }
05148 if (ipixel->lnk != 0)
05149 break;
05150
05151 #ifdef DEBUG
05152 if (ipixel == trace_pixel_ptr) {
05153 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05154 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05155 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05156 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05157 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05158 }
05159 #endif
05160 ;
05161
05162 acc_opc = 0;
05163 acc_rclr = acc_gclr = acc_bclr = 0;
05164 if (last_run_state & TOP_NONZERO) {
05165 if (!voxels_loaded) {
05166
05167 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
05168
05169
05170 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
05171 ;
05172
05173
05174 top_rclr =
05175 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05176
05177 top_gclr =
05178 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05179
05180 top_bclr =
05181 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05182 ;
05183 ;
05184 ;
05185 shade_factor = top_opc * slice_depth_cueing;
05186
05187 top_rclr *= shade_factor;
05188 top_gclr *= shade_factor;
05189 top_bclr *= shade_factor;
05190 ;
05191 }
05192
05193 acc_opc += top_opc * wgtTL;
05194
05195 acc_rclr += top_rclr * wgtTL;
05196 acc_gclr += top_gclr * wgtTL;
05197 acc_bclr += top_bclr * wgtTL;
05198
05199 #ifdef DEBUG
05200 if (ipixel == trace_pixel_ptr) {
05201 trace_opcTL = top_opc;
05202 trace_rclrTL = top_rclr;
05203 trace_gclrTL = top_gclr;
05204 trace_bclrTL = top_bclr;
05205
05206 }
05207 #endif
05208 ;
05209 }
05210 if (last_run_state & BOT_NONZERO) {
05211 if (!voxels_loaded) {
05212
05213 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
05214
05215
05216 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
05217 ;
05218
05219
05220 bot_rclr =
05221 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05222
05223 bot_gclr =
05224 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05225
05226 bot_bclr =
05227 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05228 ;
05229 ;
05230 ;
05231 shade_factor = bot_opc * slice_depth_cueing;
05232
05233 bot_rclr *= shade_factor;
05234 bot_gclr *= shade_factor;
05235 bot_bclr *= shade_factor;
05236 ;
05237 }
05238
05239 acc_opc += bot_opc * wgtBL;
05240
05241 acc_rclr += bot_rclr * wgtBL;
05242 acc_gclr += bot_gclr * wgtBL;
05243 acc_bclr += bot_bclr * wgtBL;
05244
05245 #ifdef DEBUG
05246 if (ipixel == trace_pixel_ptr) {
05247 trace_opcBL = bot_opc;
05248 trace_rclrBL = bot_rclr;
05249 trace_gclrBL = bot_gclr;
05250 trace_bclrBL = bot_bclr;
05251
05252 }
05253 #endif
05254 ;
05255 }
05256 if (run_state & TOP_NONZERO) {
05257
05258 top_opc = opac_correct[ByteField(topRLEdata, voxel_istride-1)];
05259
05260
05261 shade_index=1*3*ShortField(topRLEdata,norm_offset);
05262 ;
05263
05264
05265 top_rclr =
05266 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05267
05268 top_gclr =
05269 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05270
05271 top_bclr =
05272 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05273 ;
05274 ;
05275 ;
05276 shade_factor = top_opc * slice_depth_cueing;
05277
05278 top_rclr *= shade_factor;
05279 top_gclr *= shade_factor;
05280 top_bclr *= shade_factor;
05281 ;
05282
05283 acc_opc += top_opc * wgtTR;
05284
05285 acc_rclr += top_rclr * wgtTR;
05286 acc_gclr += top_gclr * wgtTR;
05287 acc_bclr += top_bclr * wgtTR;
05288
05289 #ifdef DEBUG
05290 if (ipixel == trace_pixel_ptr) {
05291 trace_opcTR = top_opc;
05292 trace_rclrTR = top_rclr;
05293 trace_gclrTR = top_gclr;
05294 trace_bclrTR = top_bclr;
05295
05296 }
05297 #endif
05298 ;
05299 topRLEdata += 1 * voxel_istride;
05300 } else {
05301 if (i != -1) {
05302 ;
05303 }
05304 }
05305 if (run_state & BOT_NONZERO) {
05306
05307 bot_opc = opac_correct[ByteField(botRLEdata, voxel_istride-1)];
05308
05309
05310 shade_index=1*3*ShortField(botRLEdata,norm_offset);
05311 ;
05312
05313
05314 bot_rclr =
05315 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05316
05317 bot_gclr =
05318 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05319
05320 bot_bclr =
05321 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05322 ;
05323 ;
05324 ;
05325 shade_factor = bot_opc * slice_depth_cueing;
05326
05327 bot_rclr *= shade_factor;
05328 bot_gclr *= shade_factor;
05329 bot_bclr *= shade_factor;
05330 ;
05331
05332 acc_opc += bot_opc * wgtBR;
05333
05334 acc_rclr += bot_rclr * wgtBR;
05335 acc_gclr += bot_gclr * wgtBR;
05336 acc_bclr += bot_bclr * wgtBR;
05337
05338 #ifdef DEBUG
05339 if (ipixel == trace_pixel_ptr) {
05340 trace_opcBR = bot_opc;
05341 trace_rclrBR = bot_rclr;
05342 trace_gclrBR = bot_gclr;
05343 trace_bclrBR = bot_bclr;
05344
05345 }
05346 #endif
05347 ;
05348 botRLEdata += 1 * voxel_istride;
05349 } else {
05350 if (i != -1) {
05351 ;
05352 }
05353 }
05354
05355 COUNT_RESAMPLE;
05356 if (acc_opc > min_opacity) {
05357 COUNT_COMPOSITE;
05358 iopc = ipixel->opcflt;
05359 # ifndef SKIP_ERT
05360 ASSERT(iopc < max_opacity);
05361 # endif
05362 iopc_inv = (float)1. - iopc;
05363
05364 ipixel->rclrflt += acc_rclr * iopc_inv;
05365 ipixel->gclrflt += acc_gclr * iopc_inv;
05366 ipixel->bclrflt += acc_bclr * iopc_inv;
05367 iopc += acc_opc * iopc_inv;
05368 ipixel->opcflt = iopc;
05369
05370 #ifdef DEBUG
05371 if (ipixel == trace_pixel_ptr) {
05372 #ifdef COMPUTE_SHADOW_BUFFER
05373 printf("{%3d} %3d %3d", k, icount-i-count, j);
05374 #else
05375 printf("[%3d] %3d %3d", k, icount-i-count, j);
05376 #endif
05377 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05378 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05379 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05380 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05381 printf(" %3.0f %3.0f\n", iopc*255.,
05382 ipixel->rclrflt);
05383
05384
05385 printf(" ");
05386 printf(" %3.0f ",trace_gclrTL);
05387 printf(" %3.0f ",trace_gclrBL);
05388 printf(" %3.0f ",trace_gclrTR);
05389 printf(" %3.0f ",trace_gclrBR);
05390 printf(" %3.0f\n", ipixel->gclrflt);
05391 printf(" ");
05392 printf(" %3.0f ",trace_bclrTL);
05393 printf(" %3.0f ",trace_bclrBL);
05394 printf(" %3.0f ",trace_bclrTR);
05395 printf(" %3.0f ",trace_bclrBR);
05396 printf(" %3.0f\n", ipixel->bclrflt);
05397 }
05398 #endif
05399 ;
05400 # ifndef SKIP_ERT
05401 if (iopc >= max_opacity) {
05402 ASSERT(ipixel->lnk == 0);
05403 ipixel->lnk = 1;
05404 }
05405 # endif
05406 };
05407 ipixel += 1;
05408 count--;
05409 SET_VOXELS_LOADED;
05410 last_run_state = run_state;
05411 }
05412 #endif
05413
05414 GET_HIRES_TIME(vpc, t1);
05415 STORE_HIRES_TIME(vpc, VPTIMER_PROCESS_VOXELS, t0, t1);
05416 COPY_HIRES_TIME(t0, t1);
05417
05418 if (count > 0) {
05419 Debug((vpc, VPDEBUG_COMPOSITE, "Backup(%d)\n", count));
05420 toprun_count += count;
05421 botrun_count += count;
05422 i += count;
05423 }
05424 #endif
05425
05426
05427
05428
05429
05430 last_run_state = run_state;
05431 }
05432
05433
05434
05435
05436
05437 #ifdef UNROLL_RUN_LOOP
05438 ASSERT(i == 0);
05439 #else
05440 ASSERT(i == -1);
05441 #endif
05442
05443 #ifndef SKIP_COMPOSITE
05444 #ifdef UNROLL_RUN_LOOP
05445
05446 if (last_run_state != ALL_ZERO && !PIXEL_IS_OPAQUE(ipixel)) {
05447
05448
05449 Debug((vpc, VPDEBUG_COMPOSITE, "Run(1)End\n"));
05450 switch (last_run_state) {
05451 case TOP_NONZERO:
05452
05453 if (!voxels_loaded) {
05454
05455 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
05456
05457
05458 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
05459 ;
05460
05461
05462 top_rclr =
05463 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05464
05465 top_gclr =
05466 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05467
05468 top_bclr =
05469 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05470 ;
05471 ;
05472 ;
05473 shade_factor = top_opc * slice_depth_cueing;
05474
05475 top_rclr *= shade_factor;
05476 top_gclr *= shade_factor;
05477 top_bclr *= shade_factor;
05478 ;
05479 }
05480
05481 #ifdef DEBUG
05482 if (ipixel == trace_pixel_ptr) {
05483 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05484 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05485 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05486 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05487 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05488 }
05489 #endif
05490 ;
05491
05492 acc_opc = top_opc * wgtTL;
05493
05494 acc_rclr = top_rclr * wgtTL;
05495 acc_gclr = top_gclr * wgtTL;
05496 acc_bclr = top_bclr * wgtTL;
05497
05498 #ifdef DEBUG
05499 if (ipixel == trace_pixel_ptr) {
05500 trace_opcTL = top_opc;
05501 trace_rclrTL = top_rclr;
05502 trace_gclrTL = top_gclr;
05503 trace_bclrTL = top_bclr;
05504
05505 }
05506 #endif
05507 ;
05508
05509 COUNT_RESAMPLE;
05510 if (acc_opc > min_opacity) {
05511 COUNT_COMPOSITE;
05512 iopc = ipixel->opcflt;
05513 # ifndef SKIP_ERT
05514 ASSERT(iopc < max_opacity);
05515 # endif
05516 iopc_inv = (float)1. - iopc;
05517
05518 ipixel->rclrflt += acc_rclr * iopc_inv;
05519 ipixel->gclrflt += acc_gclr * iopc_inv;
05520 ipixel->bclrflt += acc_bclr * iopc_inv;
05521 iopc += acc_opc * iopc_inv;
05522 ipixel->opcflt = iopc;
05523
05524 #ifdef DEBUG
05525 if (ipixel == trace_pixel_ptr) {
05526 #ifdef COMPUTE_SHADOW_BUFFER
05527 printf("{%3d} %3d %3d", k, icount-i-count, j);
05528 #else
05529 printf("[%3d] %3d %3d", k, icount-i-count, j);
05530 #endif
05531 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05532 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05533 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05534 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05535 printf(" %3.0f %3.0f\n", iopc*255.,
05536 ipixel->rclrflt);
05537
05538
05539 printf(" ");
05540 printf(" %3.0f ",trace_gclrTL);
05541 printf(" %3.0f ",trace_gclrBL);
05542 printf(" %3.0f ",trace_gclrTR);
05543 printf(" %3.0f ",trace_gclrBR);
05544 printf(" %3.0f\n", ipixel->gclrflt);
05545 printf(" ");
05546 printf(" %3.0f ",trace_bclrTL);
05547 printf(" %3.0f ",trace_bclrBL);
05548 printf(" %3.0f ",trace_bclrTR);
05549 printf(" %3.0f ",trace_bclrBR);
05550 printf(" %3.0f\n", ipixel->bclrflt);
05551 }
05552 #endif
05553 ;
05554 # ifndef SKIP_ERT
05555 if (iopc >= max_opacity) {
05556 ASSERT(ipixel->lnk == 0);
05557 ipixel->lnk = 1;
05558 }
05559 # endif
05560 };
05561 break;
05562 case BOT_NONZERO:
05563
05564 if (!voxels_loaded) {
05565
05566 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
05567
05568
05569 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
05570 ;
05571
05572
05573 bot_rclr =
05574 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05575
05576 bot_gclr =
05577 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05578
05579 bot_bclr =
05580 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05581 ;
05582 ;
05583 ;
05584 shade_factor = bot_opc * slice_depth_cueing;
05585
05586 bot_rclr *= shade_factor;
05587 bot_gclr *= shade_factor;
05588 bot_bclr *= shade_factor;
05589 ;
05590 }
05591
05592 #ifdef DEBUG
05593 if (ipixel == trace_pixel_ptr) {
05594 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05595 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05596 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05597 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05598 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05599 }
05600 #endif
05601 ;
05602
05603 acc_opc = bot_opc * wgtBL;
05604
05605 acc_rclr = bot_rclr * wgtBL;
05606 acc_gclr = bot_gclr * wgtBL;
05607 acc_bclr = bot_bclr * wgtBL;
05608
05609 #ifdef DEBUG
05610 if (ipixel == trace_pixel_ptr) {
05611 trace_opcBL = bot_opc;
05612 trace_rclrBL = bot_rclr;
05613 trace_gclrBL = bot_gclr;
05614 trace_bclrBL = bot_bclr;
05615
05616 }
05617 #endif
05618 ;
05619
05620 COUNT_RESAMPLE;
05621 if (acc_opc > min_opacity) {
05622 COUNT_COMPOSITE;
05623 iopc = ipixel->opcflt;
05624 # ifndef SKIP_ERT
05625 ASSERT(iopc < max_opacity);
05626 # endif
05627 iopc_inv = (float)1. - iopc;
05628
05629 ipixel->rclrflt += acc_rclr * iopc_inv;
05630 ipixel->gclrflt += acc_gclr * iopc_inv;
05631 ipixel->bclrflt += acc_bclr * iopc_inv;
05632 iopc += acc_opc * iopc_inv;
05633 ipixel->opcflt = iopc;
05634
05635 #ifdef DEBUG
05636 if (ipixel == trace_pixel_ptr) {
05637 #ifdef COMPUTE_SHADOW_BUFFER
05638 printf("{%3d} %3d %3d", k, icount-i-count, j);
05639 #else
05640 printf("[%3d] %3d %3d", k, icount-i-count, j);
05641 #endif
05642 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05643 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05644 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05645 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05646 printf(" %3.0f %3.0f\n", iopc*255.,
05647 ipixel->rclrflt);
05648
05649
05650 printf(" ");
05651 printf(" %3.0f ",trace_gclrTL);
05652 printf(" %3.0f ",trace_gclrBL);
05653 printf(" %3.0f ",trace_gclrTR);
05654 printf(" %3.0f ",trace_gclrBR);
05655 printf(" %3.0f\n", ipixel->gclrflt);
05656 printf(" ");
05657 printf(" %3.0f ",trace_bclrTL);
05658 printf(" %3.0f ",trace_bclrBL);
05659 printf(" %3.0f ",trace_bclrTR);
05660 printf(" %3.0f ",trace_bclrBR);
05661 printf(" %3.0f\n", ipixel->bclrflt);
05662 }
05663 #endif
05664 ;
05665 # ifndef SKIP_ERT
05666 if (iopc >= max_opacity) {
05667 ASSERT(ipixel->lnk == 0);
05668 ipixel->lnk = 1;
05669 }
05670 # endif
05671 };
05672 break;
05673 case ALL_NONZERO:
05674
05675 if (!voxels_loaded) {
05676
05677 top_opc = opac_correct[ByteField(topRLEdata - voxel_istride, voxel_istride-1)];
05678
05679
05680 shade_index=1*3*ShortField(topRLEdata - voxel_istride,norm_offset);
05681 ;
05682
05683
05684 top_rclr =
05685 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05686
05687 top_gclr =
05688 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05689
05690 top_bclr =
05691 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05692 ;
05693 ;
05694 ;
05695 shade_factor = top_opc * slice_depth_cueing;
05696
05697 top_rclr *= shade_factor;
05698 top_gclr *= shade_factor;
05699 top_bclr *= shade_factor;
05700 ;
05701
05702 bot_opc = opac_correct[ByteField(botRLEdata - voxel_istride, voxel_istride-1)];
05703
05704
05705 shade_index=1*3*ShortField(botRLEdata - voxel_istride,norm_offset);
05706 ;
05707
05708
05709 bot_rclr =
05710 shade_table[shade_index + 3*0 + 0] * (float)1.0;
05711
05712 bot_gclr =
05713 shade_table[shade_index + 3*0 + 1] * (float)1.0;
05714
05715 bot_bclr =
05716 shade_table[shade_index + 3*0 + 2] * (float)1.0;
05717 ;
05718 ;
05719 ;
05720 shade_factor = bot_opc * slice_depth_cueing;
05721
05722 bot_rclr *= shade_factor;
05723 bot_gclr *= shade_factor;
05724 bot_bclr *= shade_factor;
05725 ;
05726 }
05727
05728 #ifdef DEBUG
05729 if (ipixel == trace_pixel_ptr) {
05730 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05731 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05732 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05733 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05734 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05735 }
05736 #endif
05737 ;
05738
05739 acc_opc = top_opc * wgtTL;
05740
05741 acc_rclr = top_rclr * wgtTL;
05742 acc_gclr = top_gclr * wgtTL;
05743 acc_bclr = top_bclr * wgtTL;
05744
05745 #ifdef DEBUG
05746 if (ipixel == trace_pixel_ptr) {
05747 trace_opcTL = top_opc;
05748 trace_rclrTL = top_rclr;
05749 trace_gclrTL = top_gclr;
05750 trace_bclrTL = top_bclr;
05751
05752 }
05753 #endif
05754 ;
05755
05756 acc_opc += bot_opc * wgtBL;
05757
05758 acc_rclr += bot_rclr * wgtBL;
05759 acc_gclr += bot_gclr * wgtBL;
05760 acc_bclr += bot_bclr * wgtBL;
05761
05762 #ifdef DEBUG
05763 if (ipixel == trace_pixel_ptr) {
05764 trace_opcBL = bot_opc;
05765 trace_rclrBL = bot_rclr;
05766 trace_gclrBL = bot_gclr;
05767 trace_bclrBL = bot_bclr;
05768
05769 }
05770 #endif
05771 ;
05772
05773 COUNT_RESAMPLE;
05774 if (acc_opc > min_opacity) {
05775 COUNT_COMPOSITE;
05776 iopc = ipixel->opcflt;
05777 # ifndef SKIP_ERT
05778 ASSERT(iopc < max_opacity);
05779 # endif
05780 iopc_inv = (float)1. - iopc;
05781
05782 ipixel->rclrflt += acc_rclr * iopc_inv;
05783 ipixel->gclrflt += acc_gclr * iopc_inv;
05784 ipixel->bclrflt += acc_bclr * iopc_inv;
05785 iopc += acc_opc * iopc_inv;
05786 ipixel->opcflt = iopc;
05787
05788 #ifdef DEBUG
05789 if (ipixel == trace_pixel_ptr) {
05790 #ifdef COMPUTE_SHADOW_BUFFER
05791 printf("{%3d} %3d %3d", k, icount-i-count, j);
05792 #else
05793 printf("[%3d] %3d %3d", k, icount-i-count, j);
05794 #endif
05795 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05796 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05797 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05798 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05799 printf(" %3.0f %3.0f\n", iopc*255.,
05800 ipixel->rclrflt);
05801
05802
05803 printf(" ");
05804 printf(" %3.0f ",trace_gclrTL);
05805 printf(" %3.0f ",trace_gclrBL);
05806 printf(" %3.0f ",trace_gclrTR);
05807 printf(" %3.0f ",trace_gclrBR);
05808 printf(" %3.0f\n", ipixel->gclrflt);
05809 printf(" ");
05810 printf(" %3.0f ",trace_bclrTL);
05811 printf(" %3.0f ",trace_bclrBL);
05812 printf(" %3.0f ",trace_bclrTR);
05813 printf(" %3.0f ",trace_bclrBR);
05814 printf(" %3.0f\n", ipixel->bclrflt);
05815 }
05816 #endif
05817 ;
05818 # ifndef SKIP_ERT
05819 if (iopc >= max_opacity) {
05820 ASSERT(ipixel->lnk == 0);
05821 ipixel->lnk = 1;
05822 }
05823 # endif
05824 };
05825 break;
05826 default:
05827 VPBug("illegal value for run state at end of scanline");
05828 }
05829 } else if (last_run_state == ALL_ZERO) {
05830 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
05831 } else {
05832 Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
05833 }
05834 #endif
05835 #endif
05836
05837 #ifndef UNROLL_RUN_LOOP
05838 run_state = final_run_state;
05839 #endif
05840
05841 if (j != 0 && ((run_state & 1) == 0)) {
05842 toprun_count = *topRLElen++;
05843 ASSERT(toprun_count == 0);
05844 }
05845 if (j != jcount && ((run_state & 2) == 0)) {
05846 botrun_count = *botRLElen++;
05847 ASSERT(botrun_count == 0);
05848 }
05849
05850
05851 #ifdef UNROLL_RUN_LOOP
05852 ipixel += intermediate_width - icount;
05853 #ifdef USE_SHADOW_BUFFER
05854 shadow_pixel += shadow_width - icount;
05855 #endif
05856 #else
05857 ipixel += intermediate_width - (icount+1);
05858 #ifdef USE_SHADOW_BUFFER
05859 shadow_pixel += shadow_width - (icount+1);
05860 #endif
05861 #endif
05862
05863 Debug((vpc, VPDEBUG_COMPOSITE, "ScanDone\n"));
05864 }
05865
05866
05867
05868
05869
05870 GET_HIRES_TIME(vpc, t1);
05871 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
05872
05873 Debug((vpc, VPDEBUG_COMPOSITE, "SliceDone\n"));
05874 }