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 #define MULTIPLE_MATERIALS
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 #define RGB
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135 #define RAWVOLUME
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 #undef INDEX_VOLUME
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 #define ALL_ZERO 0
00161 #define TOP_NONZERO 1
00162 #define BOT_NONZERO 2
00163 #define ALL_NONZERO 3
00164
00165
00166 #define ALL_ZERO__ALL_ZERO ((ALL_ZERO << 2) | ALL_ZERO)
00167 #define ALL_ZERO__TOP_NONZERO ((ALL_ZERO << 2) | TOP_NONZERO)
00168 #define ALL_ZERO__BOT_NONZERO ((ALL_ZERO << 2) | BOT_NONZERO)
00169 #define ALL_ZERO__ALL_NONZERO ((ALL_ZERO << 2) | ALL_NONZERO)
00170 #define TOP_NONZERO__ALL_ZERO ((TOP_NONZERO << 2) | ALL_ZERO)
00171 #define TOP_NONZERO__TOP_NONZERO ((TOP_NONZERO << 2) | TOP_NONZERO)
00172 #define TOP_NONZERO__BOT_NONZERO ((TOP_NONZERO << 2) | BOT_NONZERO)
00173 #define TOP_NONZERO__ALL_NONZERO ((TOP_NONZERO << 2) | ALL_NONZERO)
00174 #define BOT_NONZERO__ALL_ZERO ((BOT_NONZERO << 2) | ALL_ZERO)
00175 #define BOT_NONZERO__TOP_NONZERO ((BOT_NONZERO << 2) | TOP_NONZERO)
00176 #define BOT_NONZERO__BOT_NONZERO ((BOT_NONZERO << 2) | BOT_NONZERO)
00177 #define BOT_NONZERO__ALL_NONZERO ((BOT_NONZERO << 2) | ALL_NONZERO)
00178 #define ALL_NONZERO__ALL_ZERO ((ALL_NONZERO << 2) | ALL_ZERO)
00179 #define ALL_NONZERO__TOP_NONZERO ((ALL_NONZERO << 2) | TOP_NONZERO)
00180 #define ALL_NONZERO__BOT_NONZERO ((ALL_NONZERO << 2) | BOT_NONZERO)
00181 #define ALL_NONZERO__ALL_NONZERO ((ALL_NONZERO << 2) | ALL_NONZERO)
00182
00183 #ifdef SKIP_ERT
00184 #define PIXEL_IS_OPAQUE(ipixel) 0
00185 #else
00186 #define PIXEL_IS_OPAQUE(ipixel) ((ipixel)->lnk != 0)
00187 #endif
00188
00189 #ifdef STATISTICS
00190 extern int vpResampleCount;
00191 extern int vpCompositeCount;
00192 extern int vpERTSkipCount;
00193 extern int vpERTSkipAgainCount;
00194 extern int vpERTUpdateCount;
00195 extern int vpSpecialZeroSkipCount;
00196 extern int vpRunFragmentCount;
00197 #define COUNT_RESAMPLE vpResampleCount++
00198 #define COUNT_COMPOSITE vpCompositeCount++
00199 #define COUNT_ERT_SKIP vpERTSkipCount++
00200 #define COUNT_ERT_SKIP_AGAIN vpERTSkipAgainCount++
00201 #define COUNT_ERT_UPDATE vpERTUpdateCount++
00202 #define COUNT_SPECIAL_ZERO_SKIP vpSpecialZeroSkipCount++
00203 #define COUNT_RUN_FRAGMENT vpRunFragmentCount++
00204 #else
00205 #define COUNT_RESAMPLE
00206 #define COUNT_COMPOSITE
00207 #define COUNT_ERT_SKIP
00208 #define COUNT_ERT_SKIP_AGAIN
00209 #define COUNT_ERT_UPDATE
00210 #define COUNT_SPECIAL_ZERO_SKIP
00211 #define COUNT_RUN_FRAGMENT
00212 #endif
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 void
00223 VPCompAR32B (vpc, icount, jcount, k, slice_depth_cueing_dbl, intimage,
00224 weightTLdbl, weightBLdbl, weightTRdbl, weightBRdbl,
00225 voxel_data, voxel_istride, voxel_jstride )
00226 vpContext *vpc;
00227 int icount;
00228 int jcount;
00229 int k;
00230 double slice_depth_cueing_dbl;
00231 RGBIntPixel *intimage;
00232 double weightTLdbl;
00233 double weightBLdbl;
00234 double weightTRdbl;
00235 double weightBRdbl;
00236
00237 void *voxel_data;
00238 int voxel_istride;
00239 int voxel_jstride;
00240
00241 {
00242 int i, j;
00243 RGBIntPixel *ipixel;
00244 RGBIntPixel *ipixel2;
00245 int update_interval;
00246 float iopc;
00247 float iopc_inv;
00248 float acc_opc;
00249 float top_opc, bot_opc;
00250 #ifdef NO_REUSE_VOXEL
00251 #define voxels_loaded 0
00252 #define CLEAR_VOXELS_LOADED
00253 #define SET_VOXELS_LOADED
00254 #else
00255 int voxels_loaded;
00256
00257 #define CLEAR_VOXELS_LOADED voxels_loaded = 0
00258 #define SET_VOXELS_LOADED voxels_loaded = 1
00259 #endif
00260 float wgtTL, wgtBL,
00261 wgtTR, wgtBR;
00262
00263
00264 unsigned char *topRLElen;
00265 unsigned char *botRLElen;
00266 char *topRLEdata;
00267 char *botRLEdata;
00268 int toprun_count;
00269 int botrun_count;
00270 int last_run_state;
00271 int run_state;
00272 int final_run_state;
00273 float min_opacity;
00274 float max_opacity;
00275 float slice_depth_cueing;
00276 float *opac_correct;
00277 int ert_skip_count;
00278 int intermediate_width;
00279 int count;
00280 float *shade_table;
00281 int norm_offset;
00282 int shade_index;
00283 float shade_factor;
00284
00285
00286 #ifdef MULTIPLE_MATERIALS
00287 float *weight_table;
00288 int wgt_offset;
00289 int weight_index;
00290 int m, num_materials;
00291 float weight1, weight2;
00292 #endif
00293
00294 #ifdef GRAYSCALE
00295 float acc_clr;
00296 float top_clr, bot_clr;
00297 #endif
00298
00299 #ifdef RGB
00300 float acc_rclr;
00301 float acc_gclr;
00302 float acc_bclr;
00303 float top_rclr;
00304 float bot_rclr;
00305 float top_gclr;
00306 float bot_gclr;
00307 float top_bclr;
00308 float bot_bclr;
00309 #endif
00310
00311 #ifdef RLEVOLUME
00312 int voxel_istride;
00313 #endif
00314
00315 #ifdef RAWVOLUME
00316 int use_octree;
00317 MMOctreeLevel level_stack[VP_MAX_OCTREE_LEVELS];
00318
00319 int scans_left;
00320 int best_view_axis;
00321 unsigned char runlen_buf1[VP_MAX_VOLUME_DIM];
00322 unsigned char runlen_buf2[VP_MAX_VOLUME_DIM];
00323 unsigned char *top_len_base;
00324 unsigned char *bot_len_base;
00325 int opac_param;
00326 float opacity;
00327 int opacity_int;
00328 int param0_offset;
00329 int param0_size;
00330 float *param0_table;
00331 int param1_offset;
00332 int param1_size;
00333 float *param1_table;
00334 int param2_offset;
00335 int param2_size;
00336 float *param2_table;
00337 #endif
00338
00339 #ifdef INDEX_VOLUME
00340 unsigned char *scanline_topRLElen;
00341 unsigned char *scanline_botRLElen;
00342 char *scanline_topRLEdata;
00343 char *scanline_botRLEdata;
00344 VoxelLocation *top_voxel_index;
00345 VoxelLocation *bot_voxel_index;
00346 VoxelLocation *vindex;
00347 int next_i;
00348 int next_scan;
00349 #endif
00350
00351 #ifdef CALLBACK
00352
00353 #ifdef GRAYSCALE
00354 void (*shade_func) ANSI_ARGS((void *, float *, void *));
00355 #endif
00356 #ifdef RGB
00357 void (*shade_func) ANSI_ARGS((void *, float *, float *, float *, void *));
00358 #endif
00359 void *client_data;
00360 #endif
00361
00362 #ifdef USE_SHADOW_BUFFER
00363 float *shadow_table;
00364 int shadow_width;
00365 GrayIntPixel *shadow_pixel;
00366 #ifdef GRAYSCALE
00367 float top_sclr, bot_sclr;
00368 #endif
00369 #ifdef RGB
00370 float top_rsclr;
00371 float bot_rsclr;
00372 float top_gsclr;
00373 float bot_gsclr;
00374 float top_bsclr;
00375 float bot_bsclr;
00376 #endif
00377 #endif
00378
00379 #ifdef DEBUG
00380 float trace_opcTL, trace_opcBL, trace_opcTR, trace_opcBR;
00381 float trace_rsclrTL, trace_rsclrBL, trace_rsclrTR, trace_rsclrBR;
00382 float trace_rclrTL, trace_rclrBL, trace_rclrTR, trace_rclrBR;
00383 float trace_gclrTL, trace_gclrBL, trace_gclrTR, trace_gclrBR;
00384 float trace_bclrTL, trace_bclrBL, trace_bclrTR, trace_bclrBR;
00385 RGBIntPixel *trace_pixel_ptr;
00386
00387 #ifdef COMPUTE_SHADOW_BUFFER
00388 int slice_u_int, shadow_slice_u_int;
00389 int slice_v_int, shadow_slice_v_int;
00390 #endif
00391 #endif
00392
00393 DECLARE_HIRES_TIME(t0);
00394 DECLARE_HIRES_TIME(t1);
00395
00396
00397
00398
00399
00400 GET_HIRES_TIME(vpc, t0);
00401
00402 wgtTL = weightTLdbl;
00403 wgtBL = weightBLdbl;
00404 wgtTR = weightTRdbl;
00405 wgtBR = weightBRdbl;
00406 slice_depth_cueing = slice_depth_cueing_dbl;
00407 min_opacity = vpc->min_opacity;
00408 max_opacity = vpc->max_opacity;
00409 #ifdef USE_SHADOW_BUFFER
00410 opac_correct = vpc->shadow_opac_correct;
00411 #else
00412 opac_correct = vpc->affine_opac_correct;
00413 #endif
00414 #ifdef COMPUTE_SHADOW_BUFFER
00415 intermediate_width = vpc->shadow_width;
00416 #else
00417 intermediate_width = vpc->intermediate_width;
00418 #endif
00419 #ifdef USE_SHADOW_BUFFER
00420 shadow_table = vpc->shadow_color_table;
00421 shadow_width = vpc->shadow_width;
00422 shadow_pixel = shadow_buffer;
00423 #endif
00424 ipixel = intimage;
00425 shade_table = vpc->shade_color_table;
00426 norm_offset = vpc->field_offset[vpc->color_field];
00427
00428 #ifdef MULTIPLE_MATERIALS
00429 weight_table = vpc->shade_weight_table;
00430 wgt_offset = vpc->field_offset[vpc->weight_field];
00431 num_materials = vpc->num_materials;
00432 #endif
00433
00434 #ifdef RLEVOLUME
00435 topRLEdata = voxel_data;
00436 botRLEdata = voxel_data;
00437 topRLElen = run_lengths;
00438 botRLElen = run_lengths;
00439 voxel_istride = vpc->rle_bytes_per_voxel;
00440 #endif
00441
00442 #ifdef RAWVOLUME
00443 ASSERT(vpc->num_clsfy_params > 0);
00444 ASSERT(vpc->num_clsfy_params < 3);
00445 param0_offset = vpc->field_offset[vpc->param_field[0]];
00446 param0_size = vpc->field_size[vpc->param_field[0]];
00447 param0_table = vpc->clsfy_table[0];
00448 if (vpc->num_clsfy_params > 1) {
00449 param1_offset = vpc->field_offset[vpc->param_field[1]];
00450 param1_size = vpc->field_size[vpc->param_field[1]];
00451 param1_table = vpc->clsfy_table[1];
00452 } else {
00453 param1_offset = 0;
00454 param1_size = 0;
00455 param1_table = NULL;
00456 }
00457 if (vpc->num_clsfy_params > 2) {
00458 param2_offset = vpc->field_offset[vpc->param_field[2]];
00459 param2_size = vpc->field_size[vpc->param_field[2]];
00460 param2_table = vpc->clsfy_table[2];
00461 } else {
00462 param2_offset = 0;
00463 param2_size = 0;
00464 param2_table = NULL;
00465 }
00466 if (vpc->mm_octree == NULL) {
00467 use_octree = 0;
00468 } else {
00469 use_octree = 1;
00470 best_view_axis = vpc->best_view_axis;
00471 VPInitOctreeLevelStack(vpc, level_stack, best_view_axis, k);
00472 scans_left = 0;
00473 bot_len_base = runlen_buf1;
00474 }
00475 #endif
00476
00477 #ifdef CALLBACK
00478 shade_func = vpc->shade_func;
00479 client_data = vpc->client_data;
00480 ASSERT(shade_func != NULL);
00481 #endif
00482
00483 #ifdef DEBUG
00484 trace_pixel_ptr = 0;
00485 if (vpc->trace_u >= 0 && vpc->trace_v >= 0) {
00486 #ifdef GRAYSCALE
00487 trace_pixel_ptr = &vpc->int_image.gray_intim[vpc->trace_u +
00488 vpc->trace_v*vpc->intermediate_width];
00489 #endif
00490 #ifdef RGB
00491 trace_pixel_ptr = &vpc->int_image.rgb_intim[vpc->trace_u +
00492 vpc->trace_v*vpc->intermediate_width];
00493 #endif
00494 #ifdef COMPUTE_SHADOW_BUFFER
00495 slice_u_int = (int)ceil(vpc->shear_i * vpc->trace_shadow_k +
00496 vpc->trans_i) - 1;
00497 shadow_slice_u_int = (int)ceil(vpc->shadow_shear_i *
00498 vpc->trace_shadow_k + vpc->shadow_trans_i) - 1;
00499 slice_v_int = (int)ceil(vpc->shear_j * vpc->trace_shadow_k
00500 + vpc->trans_j) - 1;
00501 shadow_slice_v_int = (int)ceil(vpc->shadow_shear_j *
00502 vpc->trace_shadow_k + vpc->shadow_trans_j) - 1;
00503 trace_pixel_ptr = &vpc->shadow_buffer[vpc->trace_u +
00504 shadow_slice_u_int - slice_u_int +
00505 (vpc->trace_v + shadow_slice_v_int -
00506 slice_v_int)*vpc->shadow_width];
00507 #endif
00508 }
00509 #endif
00510
00511
00512
00513
00514
00515 for (j = 0; j <= jcount; j++) {
00516
00517
00518
00519
00520
00521 i = icount;
00522 CLEAR_VOXELS_LOADED;
00523 last_run_state = ALL_ZERO;
00524
00525 #ifdef RAWVOLUME
00526 botRLEdata = (char *)voxel_data + j*voxel_jstride;
00527 topRLEdata = botRLEdata - voxel_jstride;
00528 if (!use_octree) {
00529 if (j == 0) {
00530 run_state = BOT_NONZERO;
00531 toprun_count = icount+2;
00532 botrun_count = icount;
00533 } else if (j == jcount) {
00534 run_state = TOP_NONZERO;
00535 toprun_count = icount;
00536 botrun_count = icount+2;
00537 } else {
00538 run_state = ALL_NONZERO;
00539 toprun_count = icount;
00540 botrun_count = icount;
00541 }
00542 } else
00543 #endif
00544 if (j == 0) {
00545 run_state = BOT_NONZERO;
00546 toprun_count = icount+2;
00547 botrun_count = 0;
00548 } else if (j == jcount) {
00549 run_state = TOP_NONZERO;
00550 toprun_count = 0;
00551 botrun_count = icount+2;
00552 } else {
00553 run_state = ALL_NONZERO;
00554 toprun_count = 0;
00555 botrun_count = 0;
00556 }
00557
00558 #ifdef INDEX_VOLUME
00559 scanline_topRLElen = topRLElen;
00560 scanline_botRLElen = botRLElen;
00561 scanline_topRLEdata = topRLEdata;
00562 scanline_botRLEdata = botRLEdata;
00563 if (j == 0) {
00564 top_voxel_index = voxel_index;
00565 bot_voxel_index = voxel_index;
00566 } else {
00567 top_voxel_index = bot_voxel_index;
00568 bot_voxel_index += icount;
00569 }
00570 #endif
00571
00572
00573
00574
00575
00576
00577 #ifdef RAWVOLUME
00578 if (use_octree) {
00579 top_len_base = bot_len_base;
00580 if (scans_left == 0) {
00581 if (bot_len_base == runlen_buf1)
00582 bot_len_base = runlen_buf2;
00583 else
00584 bot_len_base = runlen_buf1;
00585
00586 GET_HIRES_TIME(vpc, t1);
00587 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00588 COPY_HIRES_TIME(t0, t1);
00589
00590 scans_left = VPComputeScanRuns(vpc, level_stack, bot_len_base,
00591 best_view_axis, j, icount);
00592
00593 GET_HIRES_TIME(vpc, t1);
00594 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_OCTREE, t0, t1);
00595 COPY_HIRES_TIME(t0, t1);
00596 }
00597 #ifdef DEBUG
00598 if (j > 0)
00599 VPCheckRuns(vpc, top_len_base, best_view_axis, k, j-1);
00600 if (j < jcount)
00601 VPCheckRuns(vpc, bot_len_base, best_view_axis, k, j);
00602 #endif
00603 scans_left--;
00604 topRLElen = top_len_base;
00605 botRLElen = bot_len_base;
00606 }
00607 #endif
00608
00609
00610
00611
00612
00613 Debug((vpc, VPDEBUG_COMPOSITE, "StartIScan(u=%d,v=%d)\n",
00614 (((int)ipixel - (int)vpc->int_image.gray_intim) /
00615 sizeof(RGBIntPixel)) % vpc->intermediate_width,
00616 (((int)ipixel - (int)vpc->int_image.gray_intim) /
00617 sizeof(RGBIntPixel)) / vpc->intermediate_width));
00618
00619 #ifdef UNROLL_RUN_LOOP
00620 while (i > 0) {
00621 #else
00622 while (i >= 0) {
00623 #endif
00624
00625
00626
00627
00628 if (last_run_state == ALL_ZERO) {
00629 #ifndef UNROLL_RUN_LOOP
00630 if (i == 0) {
00631 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
00632 ipixel += 1;
00633 final_run_state = ALL_ZERO;
00634 i = -1;
00635 break;
00636 }
00637 #endif
00638
00639
00640 while (toprun_count == 0) {
00641 toprun_count = *topRLElen++;
00642 run_state ^= 1;
00643 }
00644 while (botrun_count == 0) {
00645 botrun_count = *botRLElen++;
00646 run_state ^= 2;
00647 }
00648 if (run_state == ALL_ZERO) {
00649 COUNT_SPECIAL_ZERO_SKIP;
00650
00651
00652 count = MIN(toprun_count, botrun_count);
00653 toprun_count -= count;
00654 botrun_count -= count;
00655 ipixel += count;
00656 topRLEdata += count * voxel_istride;
00657 botRLEdata += count * voxel_istride;
00658 i -= count;
00659 ASSERT(i >= 0);
00660 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(%d)\n", count));
00661 continue;
00662 }
00663 }
00664
00665 #ifndef SKIP_ERT
00666
00667
00668
00669
00670 if ((ert_skip_count = ipixel->lnk) != 0) {
00671
00672 GET_HIRES_TIME(vpc, t1);
00673 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00674 COPY_HIRES_TIME(t0, t1);
00675
00676 COUNT_ERT_SKIP;
00677
00678 #ifndef UNROLL_RUN_LOOP
00679 if (i == 0) {
00680 ipixel += 1;
00681 final_run_state = last_run_state;
00682 i = -1;
00683 Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
00684 break;
00685 }
00686 #endif
00687
00688
00689 if (ert_skip_count < i &&
00690 (count = ipixel[ert_skip_count].lnk) != 0) {
00691
00692 do {
00693 COUNT_ERT_SKIP_AGAIN;
00694 ert_skip_count += count;
00695 } while (ert_skip_count < i &&
00696 (count = ipixel[ert_skip_count].lnk) != 0);
00697
00698
00699
00700
00701
00702
00703 ipixel2 = ipixel;
00704 update_interval = 1;
00705 count = ert_skip_count - 1;
00706 while (count > 0) {
00707 COUNT_ERT_UPDATE;
00708 ipixel2 += update_interval;
00709 if (count > 255)
00710 ipixel2->lnk = 255;
00711 else
00712 ipixel2->lnk = count;
00713 update_interval *= 2;
00714 count -= update_interval;
00715 }
00716
00717
00718 COUNT_ERT_UPDATE;
00719 if (ert_skip_count > 255)
00720 ert_skip_count = 255;
00721 ipixel->lnk = ert_skip_count;
00722 }
00723
00724
00725 if (ert_skip_count > i)
00726 ert_skip_count = i;
00727 Debug((vpc, VPDEBUG_COMPOSITE,"ERTSkip(%d)\n",ert_skip_count));
00728 ipixel += ert_skip_count;
00729 CLEAR_VOXELS_LOADED;
00730
00731 #ifdef INDEX_VOLUME
00732
00733 next_i = icount - i + ert_skip_count;
00734 if (next_i == icount) {
00735 next_i--;
00736 next_scan = 1;
00737 } else {
00738 next_scan = 0;
00739 }
00740
00741
00742 vindex = &top_voxel_index[next_i];
00743 toprun_count = vindex->run_count;
00744 topRLElen = scanline_topRLElen + vindex->len_offset;
00745 if (vindex->data_offset & INDEX_RUN_IS_ZERO) {
00746 run_state &= ~1;
00747 topRLEdata = scanline_topRLEdata +
00748 (vindex->data_offset & ~INDEX_RUN_IS_ZERO);
00749 } else {
00750 run_state |= 1;
00751 topRLEdata = scanline_topRLEdata + vindex->data_offset;
00752 }
00753
00754
00755 vindex = &bot_voxel_index[next_i];
00756 botrun_count = vindex->run_count;
00757 botRLElen = scanline_botRLElen + vindex->len_offset;
00758 if (vindex->data_offset & INDEX_RUN_IS_ZERO) {
00759 run_state &= ~2;
00760 botRLEdata = scanline_botRLEdata +
00761 (vindex->data_offset & ~INDEX_RUN_IS_ZERO);
00762 } else {
00763 run_state |= 2;
00764 botRLEdata = scanline_botRLEdata + vindex->data_offset;
00765 }
00766
00767
00768 if (next_scan) {
00769
00770 while (toprun_count == 0) {
00771 toprun_count = *topRLElen++;
00772 run_state ^= 1;
00773 }
00774 toprun_count--;
00775 if (run_state & 1) {
00776 topRLEdata += 1 * voxel_istride;
00777 } else {
00778 topRLEdata += 1 * voxel_istride;
00779 }
00780
00781
00782 while (botrun_count == 0) {
00783 botrun_count = *botRLElen++;
00784 run_state ^= 2;
00785 }
00786 botrun_count--;
00787 if (run_state & 2) {
00788 botRLEdata += 1 * voxel_istride;
00789 } else {
00790 botRLEdata += 1 * voxel_istride;
00791 }
00792 }
00793
00794 #else
00795
00796 count = ert_skip_count;
00797 for (;;) {
00798 if (toprun_count >= count) {
00799 toprun_count -= count;
00800 if (run_state & 1) {
00801 topRLEdata += count * voxel_istride;
00802 } else {
00803 topRLEdata += count * voxel_istride;
00804 }
00805 break;
00806 } else {
00807 count -= toprun_count;
00808 if (run_state & 1) {
00809 topRLEdata += toprun_count * voxel_istride;
00810 } else {
00811 topRLEdata += toprun_count * voxel_istride;
00812 }
00813 toprun_count = *topRLElen++;
00814 if (toprun_count == 0)
00815 toprun_count = *topRLElen++;
00816 else
00817 run_state ^= 1;
00818 }
00819 }
00820
00821
00822 count = ert_skip_count;
00823 for (;;) {
00824 if (botrun_count >= count) {
00825 botrun_count -= count;
00826 if (run_state & 2) {
00827 botRLEdata += count * voxel_istride;
00828 } else {
00829 botRLEdata += count * voxel_istride;
00830 }
00831 break;
00832 } else {
00833 count -= botrun_count;
00834 if (run_state & 2) {
00835 botRLEdata += botrun_count * voxel_istride;
00836 } else {
00837 botRLEdata += botrun_count * voxel_istride;
00838 }
00839 botrun_count = *botRLElen++;
00840 if (botrun_count == 0)
00841 botrun_count = *botRLElen++;
00842 else
00843 run_state ^= 2;
00844 }
00845 }
00846 #endif
00847 i -= ert_skip_count;
00848 last_run_state = run_state;
00849 if (i == 0) {
00850 #ifdef UNROLL_RUN_LOOP
00851 break;
00852 #else
00853 if (last_run_state == ALL_ZERO) {
00854 ipixel += 1;
00855 final_run_state = ALL_ZERO;
00856 i = -1;
00857 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
00858 break;
00859 }
00860 if (ipixel->lnk != 0) {
00861 ipixel += 1;
00862 final_run_state = last_run_state;
00863 i = -1;
00864 Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
00865 break;
00866 }
00867 #endif
00868 }
00869
00870 GET_HIRES_TIME(vpc, t1);
00871 STORE_HIRES_TIME(vpc, VPTIMER_ERT, t0, t1);
00872 COPY_HIRES_TIME(t0, t1);
00873 }
00874 ASSERT(ipixel->opcflt < max_opacity);
00875 #endif
00876
00877
00878
00879
00880
00881 #ifndef UNROLL_RUN_LOOP
00882 if (i == 0) {
00883 final_run_state = last_run_state;
00884 run_state = ALL_ZERO;
00885 i = -1;
00886 count = 1;
00887 Debug((vpc, VPDEBUG_COMPOSITE, "Run(1)End\n"));
00888 } else {
00889 #endif
00890
00891 while (toprun_count == 0) {
00892 toprun_count = *topRLElen++;
00893 run_state ^= 1;
00894 }
00895 while (botrun_count == 0) {
00896 botrun_count = *botRLElen++;
00897 run_state ^= 2;
00898 }
00899
00900
00901 count = MIN(toprun_count, botrun_count);
00902 toprun_count -= count;
00903 botrun_count -= count;
00904 i -= count;
00905 Debug((vpc, VPDEBUG_COMPOSITE, "Run(%d)\n", count));
00906 ASSERT(i >= 0);
00907 #ifndef UNROLL_RUN_LOOP
00908 }
00909 #endif
00910 COUNT_RUN_FRAGMENT;
00911
00912
00913
00914
00915
00916 GET_HIRES_TIME(vpc, t1);
00917 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
00918 COPY_HIRES_TIME(t0, t1);
00919
00920 #ifdef SKIP_COMPOSITE
00921 switch (run_state) {
00922 case ALL_ZERO:
00923 ipixel += count;
00924 topRLEdata += count * voxel_istride;
00925 botRLEdata += count * voxel_istride;
00926 count = 0;
00927 break;
00928 case TOP_NONZERO:
00929 ipixel += count;
00930 topRLEdata += count * voxel_istride;
00931 botRLEdata += count * voxel_istride;
00932 count = 0;
00933 break;
00934 case BOT_NONZERO:
00935 ipixel += count;
00936 topRLEdata += count * voxel_istride;
00937 botRLEdata += count * voxel_istride;
00938 count = 0;
00939 break;
00940 case ALL_NONZERO:
00941 ipixel += count;
00942 topRLEdata += count * voxel_istride;
00943 botRLEdata += count * voxel_istride;
00944 count = 0;
00945 break;
00946 }
00947 #else
00948 #ifdef UNROLL_RUN_LOOP
00949
00950 switch ((last_run_state << 2) | run_state) {
00951 case ALL_ZERO__ALL_ZERO:
00952
00953 ipixel += count;
00954 topRLEdata += count * voxel_istride;
00955 botRLEdata += count * voxel_istride;
00956 count = 0;
00957 break;
00958 case TOP_NONZERO__ALL_ZERO:
00959
00960
00961 if (!voxels_loaded) {
00962
00963
00964 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
00965 opacity = param0_table[opac_param];
00966 if (param1_size != 0) {
00967 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
00968 opacity *= param1_table[opac_param];
00969 if (param2_size != 0) {
00970 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
00971 opacity *= param2_table[opac_param];
00972 }
00973 }
00974 if (opacity > min_opacity) {
00975 opacity_int = opacity*255.;
00976 top_opc = opac_correct[opacity_int];
00977 } else {
00978 top_opc = (float)0.;
00979 };
00980
00981
00982 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
00983 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
00984
00985
00986
00987 top_rclr =
00988 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
00989
00990 top_gclr =
00991 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
00992
00993 top_bclr =
00994 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
00995 ;
00996 ;
00997 ;
00998
00999
01000 top_rclr +=
01001 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01002
01003 top_gclr +=
01004 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01005
01006 top_bclr +=
01007 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01008 ;
01009 ;
01010 ;
01011 shade_factor = top_opc * slice_depth_cueing;
01012
01013 top_rclr *= shade_factor;
01014 top_gclr *= shade_factor;
01015 top_bclr *= shade_factor;
01016 ;
01017 }
01018
01019 #ifdef DEBUG
01020 if (ipixel == trace_pixel_ptr) {
01021 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01022 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01023 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01024 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01025 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01026 }
01027 #endif
01028 ;
01029
01030 acc_opc = top_opc * wgtTL;
01031
01032 acc_rclr = top_rclr * wgtTL;
01033 acc_gclr = top_gclr * wgtTL;
01034 acc_bclr = top_bclr * wgtTL;
01035
01036 #ifdef DEBUG
01037 if (ipixel == trace_pixel_ptr) {
01038 trace_opcTL = top_opc;
01039 trace_rclrTL = top_rclr;
01040 trace_gclrTL = top_gclr;
01041 trace_bclrTL = top_bclr;
01042
01043 }
01044 #endif
01045 ;
01046
01047 COUNT_RESAMPLE;
01048 if (acc_opc > min_opacity) {
01049 COUNT_COMPOSITE;
01050 iopc = ipixel->opcflt;
01051 # ifndef SKIP_ERT
01052 ASSERT(iopc < max_opacity);
01053 # endif
01054 iopc_inv = (float)1. - iopc;
01055
01056 ipixel->rclrflt += acc_rclr * iopc_inv;
01057 ipixel->gclrflt += acc_gclr * iopc_inv;
01058 ipixel->bclrflt += acc_bclr * iopc_inv;
01059 iopc += acc_opc * iopc_inv;
01060 ipixel->opcflt = iopc;
01061
01062 #ifdef DEBUG
01063 if (ipixel == trace_pixel_ptr) {
01064 #ifdef COMPUTE_SHADOW_BUFFER
01065 printf("{%3d} %3d %3d", k, icount-i-count, j);
01066 #else
01067 printf("[%3d] %3d %3d", k, icount-i-count, j);
01068 #endif
01069 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01070 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01071 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01072 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01073 printf(" %3.0f %3.0f\n", iopc*255.,
01074 ipixel->rclrflt);
01075
01076
01077 printf(" ");
01078 printf(" %3.0f ",trace_gclrTL);
01079 printf(" %3.0f ",trace_gclrBL);
01080 printf(" %3.0f ",trace_gclrTR);
01081 printf(" %3.0f ",trace_gclrBR);
01082 printf(" %3.0f\n", ipixel->gclrflt);
01083 printf(" ");
01084 printf(" %3.0f ",trace_bclrTL);
01085 printf(" %3.0f ",trace_bclrBL);
01086 printf(" %3.0f ",trace_bclrTR);
01087 printf(" %3.0f ",trace_bclrBR);
01088 printf(" %3.0f\n", ipixel->bclrflt);
01089 }
01090 #endif
01091 ;
01092 # ifndef SKIP_ERT
01093 if (iopc >= max_opacity) {
01094 ASSERT(ipixel->lnk == 0);
01095 ipixel->lnk = 1;
01096 }
01097 # endif
01098 };
01099 ipixel += count;
01100 topRLEdata += count * voxel_istride;
01101 botRLEdata += count * voxel_istride;
01102 count = 0;
01103 break;
01104 case BOT_NONZERO__ALL_ZERO:
01105
01106
01107 if (!voxels_loaded) {
01108
01109
01110 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
01111 opacity = param0_table[opac_param];
01112 if (param1_size != 0) {
01113 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
01114 opacity *= param1_table[opac_param];
01115 if (param2_size != 0) {
01116 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
01117 opacity *= param2_table[opac_param];
01118 }
01119 }
01120 if (opacity > min_opacity) {
01121 opacity_int = opacity*255.;
01122 bot_opc = opac_correct[opacity_int];
01123 } else {
01124 bot_opc = (float)0.;
01125 };
01126
01127
01128 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
01129 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
01130
01131
01132
01133 bot_rclr =
01134 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01135
01136 bot_gclr =
01137 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01138
01139 bot_bclr =
01140 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01141 ;
01142 ;
01143 ;
01144
01145
01146 bot_rclr +=
01147 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01148
01149 bot_gclr +=
01150 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01151
01152 bot_bclr +=
01153 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01154 ;
01155 ;
01156 ;
01157 shade_factor = bot_opc * slice_depth_cueing;
01158
01159 bot_rclr *= shade_factor;
01160 bot_gclr *= shade_factor;
01161 bot_bclr *= shade_factor;
01162 ;
01163 }
01164
01165 #ifdef DEBUG
01166 if (ipixel == trace_pixel_ptr) {
01167 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01168 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01169 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01170 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01171 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01172 }
01173 #endif
01174 ;
01175
01176 acc_opc = bot_opc * wgtBL;
01177
01178 acc_rclr = bot_rclr * wgtBL;
01179 acc_gclr = bot_gclr * wgtBL;
01180 acc_bclr = bot_bclr * wgtBL;
01181
01182 #ifdef DEBUG
01183 if (ipixel == trace_pixel_ptr) {
01184 trace_opcBL = bot_opc;
01185 trace_rclrBL = bot_rclr;
01186 trace_gclrBL = bot_gclr;
01187 trace_bclrBL = bot_bclr;
01188
01189 }
01190 #endif
01191 ;
01192
01193 COUNT_RESAMPLE;
01194 if (acc_opc > min_opacity) {
01195 COUNT_COMPOSITE;
01196 iopc = ipixel->opcflt;
01197 # ifndef SKIP_ERT
01198 ASSERT(iopc < max_opacity);
01199 # endif
01200 iopc_inv = (float)1. - iopc;
01201
01202 ipixel->rclrflt += acc_rclr * iopc_inv;
01203 ipixel->gclrflt += acc_gclr * iopc_inv;
01204 ipixel->bclrflt += acc_bclr * iopc_inv;
01205 iopc += acc_opc * iopc_inv;
01206 ipixel->opcflt = iopc;
01207
01208 #ifdef DEBUG
01209 if (ipixel == trace_pixel_ptr) {
01210 #ifdef COMPUTE_SHADOW_BUFFER
01211 printf("{%3d} %3d %3d", k, icount-i-count, j);
01212 #else
01213 printf("[%3d] %3d %3d", k, icount-i-count, j);
01214 #endif
01215 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01216 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01217 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01218 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01219 printf(" %3.0f %3.0f\n", iopc*255.,
01220 ipixel->rclrflt);
01221
01222
01223 printf(" ");
01224 printf(" %3.0f ",trace_gclrTL);
01225 printf(" %3.0f ",trace_gclrBL);
01226 printf(" %3.0f ",trace_gclrTR);
01227 printf(" %3.0f ",trace_gclrBR);
01228 printf(" %3.0f\n", ipixel->gclrflt);
01229 printf(" ");
01230 printf(" %3.0f ",trace_bclrTL);
01231 printf(" %3.0f ",trace_bclrBL);
01232 printf(" %3.0f ",trace_bclrTR);
01233 printf(" %3.0f ",trace_bclrBR);
01234 printf(" %3.0f\n", ipixel->bclrflt);
01235 }
01236 #endif
01237 ;
01238 # ifndef SKIP_ERT
01239 if (iopc >= max_opacity) {
01240 ASSERT(ipixel->lnk == 0);
01241 ipixel->lnk = 1;
01242 }
01243 # endif
01244 };
01245 ipixel += count;
01246 topRLEdata += count * voxel_istride;
01247 botRLEdata += count * voxel_istride;
01248 count = 0;
01249 break;
01250 case ALL_NONZERO__ALL_ZERO:
01251
01252
01253 if (!voxels_loaded) {
01254
01255
01256 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
01257 opacity = param0_table[opac_param];
01258 if (param1_size != 0) {
01259 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
01260 opacity *= param1_table[opac_param];
01261 if (param2_size != 0) {
01262 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
01263 opacity *= param2_table[opac_param];
01264 }
01265 }
01266 if (opacity > min_opacity) {
01267 opacity_int = opacity*255.;
01268 top_opc = opac_correct[opacity_int];
01269 } else {
01270 top_opc = (float)0.;
01271 };
01272
01273
01274 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
01275 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
01276
01277
01278
01279 top_rclr =
01280 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01281
01282 top_gclr =
01283 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01284
01285 top_bclr =
01286 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01287 ;
01288 ;
01289 ;
01290
01291
01292 top_rclr +=
01293 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01294
01295 top_gclr +=
01296 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01297
01298 top_bclr +=
01299 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01300 ;
01301 ;
01302 ;
01303 shade_factor = top_opc * slice_depth_cueing;
01304
01305 top_rclr *= shade_factor;
01306 top_gclr *= shade_factor;
01307 top_bclr *= shade_factor;
01308 ;
01309
01310
01311 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
01312 opacity = param0_table[opac_param];
01313 if (param1_size != 0) {
01314 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
01315 opacity *= param1_table[opac_param];
01316 if (param2_size != 0) {
01317 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
01318 opacity *= param2_table[opac_param];
01319 }
01320 }
01321 if (opacity > min_opacity) {
01322 opacity_int = opacity*255.;
01323 bot_opc = opac_correct[opacity_int];
01324 } else {
01325 bot_opc = (float)0.;
01326 };
01327
01328
01329 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
01330 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
01331
01332
01333
01334 bot_rclr =
01335 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01336
01337 bot_gclr =
01338 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01339
01340 bot_bclr =
01341 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01342 ;
01343 ;
01344 ;
01345
01346
01347 bot_rclr +=
01348 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01349
01350 bot_gclr +=
01351 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01352
01353 bot_bclr +=
01354 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01355 ;
01356 ;
01357 ;
01358 shade_factor = bot_opc * slice_depth_cueing;
01359
01360 bot_rclr *= shade_factor;
01361 bot_gclr *= shade_factor;
01362 bot_bclr *= shade_factor;
01363 ;
01364 }
01365
01366 #ifdef DEBUG
01367 if (ipixel == trace_pixel_ptr) {
01368 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01369 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01370 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01371 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01372 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01373 }
01374 #endif
01375 ;
01376
01377 acc_opc = top_opc * wgtTL;
01378
01379 acc_rclr = top_rclr * wgtTL;
01380 acc_gclr = top_gclr * wgtTL;
01381 acc_bclr = top_bclr * wgtTL;
01382
01383 #ifdef DEBUG
01384 if (ipixel == trace_pixel_ptr) {
01385 trace_opcTL = top_opc;
01386 trace_rclrTL = top_rclr;
01387 trace_gclrTL = top_gclr;
01388 trace_bclrTL = top_bclr;
01389
01390 }
01391 #endif
01392 ;
01393
01394 acc_opc += bot_opc * wgtBL;
01395
01396 acc_rclr += bot_rclr * wgtBL;
01397 acc_gclr += bot_gclr * wgtBL;
01398 acc_bclr += bot_bclr * wgtBL;
01399
01400 #ifdef DEBUG
01401 if (ipixel == trace_pixel_ptr) {
01402 trace_opcBL = bot_opc;
01403 trace_rclrBL = bot_rclr;
01404 trace_gclrBL = bot_gclr;
01405 trace_bclrBL = bot_bclr;
01406
01407 }
01408 #endif
01409 ;
01410
01411 COUNT_RESAMPLE;
01412 if (acc_opc > min_opacity) {
01413 COUNT_COMPOSITE;
01414 iopc = ipixel->opcflt;
01415 # ifndef SKIP_ERT
01416 ASSERT(iopc < max_opacity);
01417 # endif
01418 iopc_inv = (float)1. - iopc;
01419
01420 ipixel->rclrflt += acc_rclr * iopc_inv;
01421 ipixel->gclrflt += acc_gclr * iopc_inv;
01422 ipixel->bclrflt += acc_bclr * iopc_inv;
01423 iopc += acc_opc * iopc_inv;
01424 ipixel->opcflt = iopc;
01425
01426 #ifdef DEBUG
01427 if (ipixel == trace_pixel_ptr) {
01428 #ifdef COMPUTE_SHADOW_BUFFER
01429 printf("{%3d} %3d %3d", k, icount-i-count, j);
01430 #else
01431 printf("[%3d] %3d %3d", k, icount-i-count, j);
01432 #endif
01433 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01434 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01435 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01436 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01437 printf(" %3.0f %3.0f\n", iopc*255.,
01438 ipixel->rclrflt);
01439
01440
01441 printf(" ");
01442 printf(" %3.0f ",trace_gclrTL);
01443 printf(" %3.0f ",trace_gclrBL);
01444 printf(" %3.0f ",trace_gclrTR);
01445 printf(" %3.0f ",trace_gclrBR);
01446 printf(" %3.0f\n", ipixel->gclrflt);
01447 printf(" ");
01448 printf(" %3.0f ",trace_bclrTL);
01449 printf(" %3.0f ",trace_bclrBL);
01450 printf(" %3.0f ",trace_bclrTR);
01451 printf(" %3.0f ",trace_bclrBR);
01452 printf(" %3.0f\n", ipixel->bclrflt);
01453 }
01454 #endif
01455 ;
01456 # ifndef SKIP_ERT
01457 if (iopc >= max_opacity) {
01458 ASSERT(ipixel->lnk == 0);
01459 ipixel->lnk = 1;
01460 }
01461 # endif
01462 };
01463 ipixel += count;
01464 topRLEdata += count * voxel_istride;
01465 botRLEdata += count * voxel_istride;
01466 count = 0;
01467 break;
01468 case ALL_ZERO__TOP_NONZERO:
01469
01470
01471
01472 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
01473 opacity = param0_table[opac_param];
01474 if (param1_size != 0) {
01475 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
01476 opacity *= param1_table[opac_param];
01477 if (param2_size != 0) {
01478 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
01479 opacity *= param2_table[opac_param];
01480 }
01481 }
01482 if (opacity > min_opacity) {
01483 opacity_int = opacity*255.;
01484 top_opc = opac_correct[opacity_int];
01485 } else {
01486 top_opc = (float)0.;
01487 };
01488
01489
01490 shade_index=2*3*ShortField(topRLEdata,norm_offset);
01491 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
01492
01493
01494
01495 top_rclr =
01496 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01497
01498 top_gclr =
01499 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01500
01501 top_bclr =
01502 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01503 ;
01504 ;
01505 ;
01506
01507
01508 top_rclr +=
01509 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01510
01511 top_gclr +=
01512 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01513
01514 top_bclr +=
01515 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01516 ;
01517 ;
01518 ;
01519 shade_factor = top_opc * slice_depth_cueing;
01520
01521 top_rclr *= shade_factor;
01522 top_gclr *= shade_factor;
01523 top_bclr *= shade_factor;
01524 ;
01525
01526 #ifdef DEBUG
01527 if (ipixel == trace_pixel_ptr) {
01528 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01529 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01530 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01531 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01532 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01533 }
01534 #endif
01535 ;
01536
01537 acc_opc = top_opc * wgtTR;
01538
01539 acc_rclr = top_rclr * wgtTR;
01540 acc_gclr = top_gclr * wgtTR;
01541 acc_bclr = top_bclr * wgtTR;
01542
01543 #ifdef DEBUG
01544 if (ipixel == trace_pixel_ptr) {
01545 trace_opcTR = top_opc;
01546 trace_rclrTR = top_rclr;
01547 trace_gclrTR = top_gclr;
01548 trace_bclrTR = top_bclr;
01549
01550 }
01551 #endif
01552 ;
01553
01554 COUNT_RESAMPLE;
01555 if (acc_opc > min_opacity) {
01556 COUNT_COMPOSITE;
01557 iopc = ipixel->opcflt;
01558 # ifndef SKIP_ERT
01559 ASSERT(iopc < max_opacity);
01560 # endif
01561 iopc_inv = (float)1. - iopc;
01562
01563 ipixel->rclrflt += acc_rclr * iopc_inv;
01564 ipixel->gclrflt += acc_gclr * iopc_inv;
01565 ipixel->bclrflt += acc_bclr * iopc_inv;
01566 iopc += acc_opc * iopc_inv;
01567 ipixel->opcflt = iopc;
01568
01569 #ifdef DEBUG
01570 if (ipixel == trace_pixel_ptr) {
01571 #ifdef COMPUTE_SHADOW_BUFFER
01572 printf("{%3d} %3d %3d", k, icount-i-count, j);
01573 #else
01574 printf("[%3d] %3d %3d", k, icount-i-count, j);
01575 #endif
01576 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01577 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01578 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01579 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01580 printf(" %3.0f %3.0f\n", iopc*255.,
01581 ipixel->rclrflt);
01582
01583
01584 printf(" ");
01585 printf(" %3.0f ",trace_gclrTL);
01586 printf(" %3.0f ",trace_gclrBL);
01587 printf(" %3.0f ",trace_gclrTR);
01588 printf(" %3.0f ",trace_gclrBR);
01589 printf(" %3.0f\n", ipixel->gclrflt);
01590 printf(" ");
01591 printf(" %3.0f ",trace_bclrTL);
01592 printf(" %3.0f ",trace_bclrBL);
01593 printf(" %3.0f ",trace_bclrTR);
01594 printf(" %3.0f ",trace_bclrBR);
01595 printf(" %3.0f\n", ipixel->bclrflt);
01596 }
01597 #endif
01598 ;
01599 # ifndef SKIP_ERT
01600 if (iopc >= max_opacity) {
01601 ASSERT(ipixel->lnk == 0);
01602 ipixel->lnk = 1;
01603 }
01604 # endif
01605 };
01606 ipixel += 1;
01607 topRLEdata += 1 * voxel_istride;
01608 botRLEdata += 1 * voxel_istride;
01609 count--;
01610 SET_VOXELS_LOADED;
01611
01612
01613
01614 while (count > 0) {
01615 if (PIXEL_IS_OPAQUE(ipixel))
01616 break;
01617 if (!voxels_loaded) {
01618
01619
01620 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
01621 opacity = param0_table[opac_param];
01622 if (param1_size != 0) {
01623 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
01624 opacity *= param1_table[opac_param];
01625 if (param2_size != 0) {
01626 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
01627 opacity *= param2_table[opac_param];
01628 }
01629 }
01630 if (opacity > min_opacity) {
01631 opacity_int = opacity*255.;
01632 top_opc = opac_correct[opacity_int];
01633 } else {
01634 top_opc = (float)0.;
01635 };
01636
01637
01638 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
01639 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
01640
01641
01642
01643 top_rclr =
01644 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01645
01646 top_gclr =
01647 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01648
01649 top_bclr =
01650 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01651 ;
01652 ;
01653 ;
01654
01655
01656 top_rclr +=
01657 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01658
01659 top_gclr +=
01660 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01661
01662 top_bclr +=
01663 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01664 ;
01665 ;
01666 ;
01667 shade_factor = top_opc * slice_depth_cueing;
01668
01669 top_rclr *= shade_factor;
01670 top_gclr *= shade_factor;
01671 top_bclr *= shade_factor;
01672 ;
01673 }
01674
01675 #ifdef DEBUG
01676 if (ipixel == trace_pixel_ptr) {
01677 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01678 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01679 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01680 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01681 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01682 }
01683 #endif
01684 ;
01685
01686 acc_opc = top_opc * wgtTL;
01687
01688 acc_rclr = top_rclr * wgtTL;
01689 acc_gclr = top_gclr * wgtTL;
01690 acc_bclr = top_bclr * wgtTL;
01691
01692 #ifdef DEBUG
01693 if (ipixel == trace_pixel_ptr) {
01694 trace_opcTL = top_opc;
01695 trace_rclrTL = top_rclr;
01696 trace_gclrTL = top_gclr;
01697 trace_bclrTL = top_bclr;
01698
01699 }
01700 #endif
01701 ;
01702
01703
01704 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
01705 opacity = param0_table[opac_param];
01706 if (param1_size != 0) {
01707 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
01708 opacity *= param1_table[opac_param];
01709 if (param2_size != 0) {
01710 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
01711 opacity *= param2_table[opac_param];
01712 }
01713 }
01714 if (opacity > min_opacity) {
01715 opacity_int = opacity*255.;
01716 top_opc = opac_correct[opacity_int];
01717 } else {
01718 top_opc = (float)0.;
01719 };
01720
01721
01722 shade_index=2*3*ShortField(topRLEdata,norm_offset);
01723 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
01724
01725
01726
01727 top_rclr =
01728 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01729
01730 top_gclr =
01731 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01732
01733 top_bclr =
01734 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01735 ;
01736 ;
01737 ;
01738
01739
01740 top_rclr +=
01741 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01742
01743 top_gclr +=
01744 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01745
01746 top_bclr +=
01747 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01748 ;
01749 ;
01750 ;
01751 shade_factor = top_opc * slice_depth_cueing;
01752
01753 top_rclr *= shade_factor;
01754 top_gclr *= shade_factor;
01755 top_bclr *= shade_factor;
01756 ;
01757
01758 acc_opc += top_opc * wgtTR;
01759
01760 acc_rclr += top_rclr * wgtTR;
01761 acc_gclr += top_gclr * wgtTR;
01762 acc_bclr += top_bclr * wgtTR;
01763
01764 #ifdef DEBUG
01765 if (ipixel == trace_pixel_ptr) {
01766 trace_opcTR = top_opc;
01767 trace_rclrTR = top_rclr;
01768 trace_gclrTR = top_gclr;
01769 trace_bclrTR = top_bclr;
01770
01771 }
01772 #endif
01773 ;
01774
01775 COUNT_RESAMPLE;
01776 if (acc_opc > min_opacity) {
01777 COUNT_COMPOSITE;
01778 iopc = ipixel->opcflt;
01779 # ifndef SKIP_ERT
01780 ASSERT(iopc < max_opacity);
01781 # endif
01782 iopc_inv = (float)1. - iopc;
01783
01784 ipixel->rclrflt += acc_rclr * iopc_inv;
01785 ipixel->gclrflt += acc_gclr * iopc_inv;
01786 ipixel->bclrflt += acc_bclr * iopc_inv;
01787 iopc += acc_opc * iopc_inv;
01788 ipixel->opcflt = iopc;
01789
01790 #ifdef DEBUG
01791 if (ipixel == trace_pixel_ptr) {
01792 #ifdef COMPUTE_SHADOW_BUFFER
01793 printf("{%3d} %3d %3d", k, icount-i-count, j);
01794 #else
01795 printf("[%3d] %3d %3d", k, icount-i-count, j);
01796 #endif
01797 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
01798 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
01799 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
01800 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
01801 printf(" %3.0f %3.0f\n", iopc*255.,
01802 ipixel->rclrflt);
01803
01804
01805 printf(" ");
01806 printf(" %3.0f ",trace_gclrTL);
01807 printf(" %3.0f ",trace_gclrBL);
01808 printf(" %3.0f ",trace_gclrTR);
01809 printf(" %3.0f ",trace_gclrBR);
01810 printf(" %3.0f\n", ipixel->gclrflt);
01811 printf(" ");
01812 printf(" %3.0f ",trace_bclrTL);
01813 printf(" %3.0f ",trace_bclrBL);
01814 printf(" %3.0f ",trace_bclrTR);
01815 printf(" %3.0f ",trace_bclrBR);
01816 printf(" %3.0f\n", ipixel->bclrflt);
01817 }
01818 #endif
01819 ;
01820 # ifndef SKIP_ERT
01821 if (iopc >= max_opacity) {
01822 ASSERT(ipixel->lnk == 0);
01823 ipixel->lnk = 1;
01824 }
01825 # endif
01826 };
01827 ipixel += 1;
01828 topRLEdata += 1 * voxel_istride;
01829 botRLEdata += 1 * voxel_istride;
01830 count--;
01831 SET_VOXELS_LOADED;
01832 }
01833 break;
01834 case TOP_NONZERO__TOP_NONZERO:
01835
01836
01837 while (count > 0) {
01838 if (PIXEL_IS_OPAQUE(ipixel))
01839 break;
01840 if (!voxels_loaded) {
01841
01842
01843 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
01844 opacity = param0_table[opac_param];
01845 if (param1_size != 0) {
01846 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
01847 opacity *= param1_table[opac_param];
01848 if (param2_size != 0) {
01849 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
01850 opacity *= param2_table[opac_param];
01851 }
01852 }
01853 if (opacity > min_opacity) {
01854 opacity_int = opacity*255.;
01855 top_opc = opac_correct[opacity_int];
01856 } else {
01857 top_opc = (float)0.;
01858 };
01859
01860
01861 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
01862 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
01863
01864
01865
01866 top_rclr =
01867 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01868
01869 top_gclr =
01870 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01871
01872 top_bclr =
01873 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01874 ;
01875 ;
01876 ;
01877
01878
01879 top_rclr +=
01880 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01881
01882 top_gclr +=
01883 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01884
01885 top_bclr +=
01886 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01887 ;
01888 ;
01889 ;
01890 shade_factor = top_opc * slice_depth_cueing;
01891
01892 top_rclr *= shade_factor;
01893 top_gclr *= shade_factor;
01894 top_bclr *= shade_factor;
01895 ;
01896 }
01897
01898 #ifdef DEBUG
01899 if (ipixel == trace_pixel_ptr) {
01900 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
01901 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
01902 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
01903 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
01904 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
01905 }
01906 #endif
01907 ;
01908
01909 acc_opc = top_opc * wgtTL;
01910
01911 acc_rclr = top_rclr * wgtTL;
01912 acc_gclr = top_gclr * wgtTL;
01913 acc_bclr = top_bclr * wgtTL;
01914
01915 #ifdef DEBUG
01916 if (ipixel == trace_pixel_ptr) {
01917 trace_opcTL = top_opc;
01918 trace_rclrTL = top_rclr;
01919 trace_gclrTL = top_gclr;
01920 trace_bclrTL = top_bclr;
01921
01922 }
01923 #endif
01924 ;
01925
01926
01927 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
01928 opacity = param0_table[opac_param];
01929 if (param1_size != 0) {
01930 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
01931 opacity *= param1_table[opac_param];
01932 if (param2_size != 0) {
01933 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
01934 opacity *= param2_table[opac_param];
01935 }
01936 }
01937 if (opacity > min_opacity) {
01938 opacity_int = opacity*255.;
01939 top_opc = opac_correct[opacity_int];
01940 } else {
01941 top_opc = (float)0.;
01942 };
01943
01944
01945 shade_index=2*3*ShortField(topRLEdata,norm_offset);
01946 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
01947
01948
01949
01950 top_rclr =
01951 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
01952
01953 top_gclr =
01954 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
01955
01956 top_bclr =
01957 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
01958 ;
01959 ;
01960 ;
01961
01962
01963 top_rclr +=
01964 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
01965
01966 top_gclr +=
01967 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
01968
01969 top_bclr +=
01970 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
01971 ;
01972 ;
01973 ;
01974 shade_factor = top_opc * slice_depth_cueing;
01975
01976 top_rclr *= shade_factor;
01977 top_gclr *= shade_factor;
01978 top_bclr *= shade_factor;
01979 ;
01980
01981 acc_opc += top_opc * wgtTR;
01982
01983 acc_rclr += top_rclr * wgtTR;
01984 acc_gclr += top_gclr * wgtTR;
01985 acc_bclr += top_bclr * wgtTR;
01986
01987 #ifdef DEBUG
01988 if (ipixel == trace_pixel_ptr) {
01989 trace_opcTR = top_opc;
01990 trace_rclrTR = top_rclr;
01991 trace_gclrTR = top_gclr;
01992 trace_bclrTR = top_bclr;
01993
01994 }
01995 #endif
01996 ;
01997
01998 COUNT_RESAMPLE;
01999 if (acc_opc > min_opacity) {
02000 COUNT_COMPOSITE;
02001 iopc = ipixel->opcflt;
02002 # ifndef SKIP_ERT
02003 ASSERT(iopc < max_opacity);
02004 # endif
02005 iopc_inv = (float)1. - iopc;
02006
02007 ipixel->rclrflt += acc_rclr * iopc_inv;
02008 ipixel->gclrflt += acc_gclr * iopc_inv;
02009 ipixel->bclrflt += acc_bclr * iopc_inv;
02010 iopc += acc_opc * iopc_inv;
02011 ipixel->opcflt = iopc;
02012
02013 #ifdef DEBUG
02014 if (ipixel == trace_pixel_ptr) {
02015 #ifdef COMPUTE_SHADOW_BUFFER
02016 printf("{%3d} %3d %3d", k, icount-i-count, j);
02017 #else
02018 printf("[%3d] %3d %3d", k, icount-i-count, j);
02019 #endif
02020 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02021 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02022 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02023 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02024 printf(" %3.0f %3.0f\n", iopc*255.,
02025 ipixel->rclrflt);
02026
02027
02028 printf(" ");
02029 printf(" %3.0f ",trace_gclrTL);
02030 printf(" %3.0f ",trace_gclrBL);
02031 printf(" %3.0f ",trace_gclrTR);
02032 printf(" %3.0f ",trace_gclrBR);
02033 printf(" %3.0f\n", ipixel->gclrflt);
02034 printf(" ");
02035 printf(" %3.0f ",trace_bclrTL);
02036 printf(" %3.0f ",trace_bclrBL);
02037 printf(" %3.0f ",trace_bclrTR);
02038 printf(" %3.0f ",trace_bclrBR);
02039 printf(" %3.0f\n", ipixel->bclrflt);
02040 }
02041 #endif
02042 ;
02043 # ifndef SKIP_ERT
02044 if (iopc >= max_opacity) {
02045 ASSERT(ipixel->lnk == 0);
02046 ipixel->lnk = 1;
02047 }
02048 # endif
02049 };
02050 ipixel += 1;
02051 topRLEdata += 1 * voxel_istride;
02052 botRLEdata += 1 * voxel_istride;
02053 count--;
02054 SET_VOXELS_LOADED;
02055 }
02056 break;
02057 case BOT_NONZERO__TOP_NONZERO:
02058
02059
02060 if (!voxels_loaded) {
02061
02062
02063 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
02064 opacity = param0_table[opac_param];
02065 if (param1_size != 0) {
02066 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
02067 opacity *= param1_table[opac_param];
02068 if (param2_size != 0) {
02069 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
02070 opacity *= param2_table[opac_param];
02071 }
02072 }
02073 if (opacity > min_opacity) {
02074 opacity_int = opacity*255.;
02075 bot_opc = opac_correct[opacity_int];
02076 } else {
02077 bot_opc = (float)0.;
02078 };
02079
02080
02081 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
02082 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
02083
02084
02085
02086 bot_rclr =
02087 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02088
02089 bot_gclr =
02090 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02091
02092 bot_bclr =
02093 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02094 ;
02095 ;
02096 ;
02097
02098
02099 bot_rclr +=
02100 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02101
02102 bot_gclr +=
02103 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02104
02105 bot_bclr +=
02106 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02107 ;
02108 ;
02109 ;
02110 shade_factor = bot_opc * slice_depth_cueing;
02111
02112 bot_rclr *= shade_factor;
02113 bot_gclr *= shade_factor;
02114 bot_bclr *= shade_factor;
02115 ;
02116 }
02117
02118 #ifdef DEBUG
02119 if (ipixel == trace_pixel_ptr) {
02120 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02121 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02122 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02123 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02124 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02125 }
02126 #endif
02127 ;
02128
02129 acc_opc = bot_opc * wgtBL;
02130
02131 acc_rclr = bot_rclr * wgtBL;
02132 acc_gclr = bot_gclr * wgtBL;
02133 acc_bclr = bot_bclr * wgtBL;
02134
02135 #ifdef DEBUG
02136 if (ipixel == trace_pixel_ptr) {
02137 trace_opcBL = bot_opc;
02138 trace_rclrBL = bot_rclr;
02139 trace_gclrBL = bot_gclr;
02140 trace_bclrBL = bot_bclr;
02141
02142 }
02143 #endif
02144 ;
02145
02146
02147 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
02148 opacity = param0_table[opac_param];
02149 if (param1_size != 0) {
02150 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
02151 opacity *= param1_table[opac_param];
02152 if (param2_size != 0) {
02153 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
02154 opacity *= param2_table[opac_param];
02155 }
02156 }
02157 if (opacity > min_opacity) {
02158 opacity_int = opacity*255.;
02159 top_opc = opac_correct[opacity_int];
02160 } else {
02161 top_opc = (float)0.;
02162 };
02163
02164
02165 shade_index=2*3*ShortField(topRLEdata,norm_offset);
02166 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
02167
02168
02169
02170 top_rclr =
02171 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02172
02173 top_gclr =
02174 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02175
02176 top_bclr =
02177 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02178 ;
02179 ;
02180 ;
02181
02182
02183 top_rclr +=
02184 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02185
02186 top_gclr +=
02187 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02188
02189 top_bclr +=
02190 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02191 ;
02192 ;
02193 ;
02194 shade_factor = top_opc * slice_depth_cueing;
02195
02196 top_rclr *= shade_factor;
02197 top_gclr *= shade_factor;
02198 top_bclr *= shade_factor;
02199 ;
02200
02201 acc_opc += top_opc * wgtTR;
02202
02203 acc_rclr += top_rclr * wgtTR;
02204 acc_gclr += top_gclr * wgtTR;
02205 acc_bclr += top_bclr * wgtTR;
02206
02207 #ifdef DEBUG
02208 if (ipixel == trace_pixel_ptr) {
02209 trace_opcTR = top_opc;
02210 trace_rclrTR = top_rclr;
02211 trace_gclrTR = top_gclr;
02212 trace_bclrTR = top_bclr;
02213
02214 }
02215 #endif
02216 ;
02217
02218 COUNT_RESAMPLE;
02219 if (acc_opc > min_opacity) {
02220 COUNT_COMPOSITE;
02221 iopc = ipixel->opcflt;
02222 # ifndef SKIP_ERT
02223 ASSERT(iopc < max_opacity);
02224 # endif
02225 iopc_inv = (float)1. - iopc;
02226
02227 ipixel->rclrflt += acc_rclr * iopc_inv;
02228 ipixel->gclrflt += acc_gclr * iopc_inv;
02229 ipixel->bclrflt += acc_bclr * iopc_inv;
02230 iopc += acc_opc * iopc_inv;
02231 ipixel->opcflt = iopc;
02232
02233 #ifdef DEBUG
02234 if (ipixel == trace_pixel_ptr) {
02235 #ifdef COMPUTE_SHADOW_BUFFER
02236 printf("{%3d} %3d %3d", k, icount-i-count, j);
02237 #else
02238 printf("[%3d] %3d %3d", k, icount-i-count, j);
02239 #endif
02240 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02241 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02242 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02243 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02244 printf(" %3.0f %3.0f\n", iopc*255.,
02245 ipixel->rclrflt);
02246
02247
02248 printf(" ");
02249 printf(" %3.0f ",trace_gclrTL);
02250 printf(" %3.0f ",trace_gclrBL);
02251 printf(" %3.0f ",trace_gclrTR);
02252 printf(" %3.0f ",trace_gclrBR);
02253 printf(" %3.0f\n", ipixel->gclrflt);
02254 printf(" ");
02255 printf(" %3.0f ",trace_bclrTL);
02256 printf(" %3.0f ",trace_bclrBL);
02257 printf(" %3.0f ",trace_bclrTR);
02258 printf(" %3.0f ",trace_bclrBR);
02259 printf(" %3.0f\n", ipixel->bclrflt);
02260 }
02261 #endif
02262 ;
02263 # ifndef SKIP_ERT
02264 if (iopc >= max_opacity) {
02265 ASSERT(ipixel->lnk == 0);
02266 ipixel->lnk = 1;
02267 }
02268 # endif
02269 };
02270 ipixel += 1;
02271 topRLEdata += 1 * voxel_istride;
02272 botRLEdata += 1 * voxel_istride;
02273 count--;
02274 SET_VOXELS_LOADED;
02275
02276
02277
02278 while (count > 0) {
02279 if (PIXEL_IS_OPAQUE(ipixel))
02280 break;
02281 if (!voxels_loaded) {
02282
02283
02284 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
02285 opacity = param0_table[opac_param];
02286 if (param1_size != 0) {
02287 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
02288 opacity *= param1_table[opac_param];
02289 if (param2_size != 0) {
02290 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
02291 opacity *= param2_table[opac_param];
02292 }
02293 }
02294 if (opacity > min_opacity) {
02295 opacity_int = opacity*255.;
02296 top_opc = opac_correct[opacity_int];
02297 } else {
02298 top_opc = (float)0.;
02299 };
02300
02301
02302 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
02303 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
02304
02305
02306
02307 top_rclr =
02308 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02309
02310 top_gclr =
02311 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02312
02313 top_bclr =
02314 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02315 ;
02316 ;
02317 ;
02318
02319
02320 top_rclr +=
02321 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02322
02323 top_gclr +=
02324 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02325
02326 top_bclr +=
02327 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02328 ;
02329 ;
02330 ;
02331 shade_factor = top_opc * slice_depth_cueing;
02332
02333 top_rclr *= shade_factor;
02334 top_gclr *= shade_factor;
02335 top_bclr *= shade_factor;
02336 ;
02337 }
02338
02339 #ifdef DEBUG
02340 if (ipixel == trace_pixel_ptr) {
02341 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02342 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02343 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02344 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02345 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02346 }
02347 #endif
02348 ;
02349
02350 acc_opc = top_opc * wgtTL;
02351
02352 acc_rclr = top_rclr * wgtTL;
02353 acc_gclr = top_gclr * wgtTL;
02354 acc_bclr = top_bclr * wgtTL;
02355
02356 #ifdef DEBUG
02357 if (ipixel == trace_pixel_ptr) {
02358 trace_opcTL = top_opc;
02359 trace_rclrTL = top_rclr;
02360 trace_gclrTL = top_gclr;
02361 trace_bclrTL = top_bclr;
02362
02363 }
02364 #endif
02365 ;
02366
02367
02368 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
02369 opacity = param0_table[opac_param];
02370 if (param1_size != 0) {
02371 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
02372 opacity *= param1_table[opac_param];
02373 if (param2_size != 0) {
02374 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
02375 opacity *= param2_table[opac_param];
02376 }
02377 }
02378 if (opacity > min_opacity) {
02379 opacity_int = opacity*255.;
02380 top_opc = opac_correct[opacity_int];
02381 } else {
02382 top_opc = (float)0.;
02383 };
02384
02385
02386 shade_index=2*3*ShortField(topRLEdata,norm_offset);
02387 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
02388
02389
02390
02391 top_rclr =
02392 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02393
02394 top_gclr =
02395 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02396
02397 top_bclr =
02398 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02399 ;
02400 ;
02401 ;
02402
02403
02404 top_rclr +=
02405 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02406
02407 top_gclr +=
02408 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02409
02410 top_bclr +=
02411 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02412 ;
02413 ;
02414 ;
02415 shade_factor = top_opc * slice_depth_cueing;
02416
02417 top_rclr *= shade_factor;
02418 top_gclr *= shade_factor;
02419 top_bclr *= shade_factor;
02420 ;
02421
02422 acc_opc += top_opc * wgtTR;
02423
02424 acc_rclr += top_rclr * wgtTR;
02425 acc_gclr += top_gclr * wgtTR;
02426 acc_bclr += top_bclr * wgtTR;
02427
02428 #ifdef DEBUG
02429 if (ipixel == trace_pixel_ptr) {
02430 trace_opcTR = top_opc;
02431 trace_rclrTR = top_rclr;
02432 trace_gclrTR = top_gclr;
02433 trace_bclrTR = top_bclr;
02434
02435 }
02436 #endif
02437 ;
02438
02439 COUNT_RESAMPLE;
02440 if (acc_opc > min_opacity) {
02441 COUNT_COMPOSITE;
02442 iopc = ipixel->opcflt;
02443 # ifndef SKIP_ERT
02444 ASSERT(iopc < max_opacity);
02445 # endif
02446 iopc_inv = (float)1. - iopc;
02447
02448 ipixel->rclrflt += acc_rclr * iopc_inv;
02449 ipixel->gclrflt += acc_gclr * iopc_inv;
02450 ipixel->bclrflt += acc_bclr * iopc_inv;
02451 iopc += acc_opc * iopc_inv;
02452 ipixel->opcflt = iopc;
02453
02454 #ifdef DEBUG
02455 if (ipixel == trace_pixel_ptr) {
02456 #ifdef COMPUTE_SHADOW_BUFFER
02457 printf("{%3d} %3d %3d", k, icount-i-count, j);
02458 #else
02459 printf("[%3d] %3d %3d", k, icount-i-count, j);
02460 #endif
02461 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02462 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02463 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02464 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02465 printf(" %3.0f %3.0f\n", iopc*255.,
02466 ipixel->rclrflt);
02467
02468
02469 printf(" ");
02470 printf(" %3.0f ",trace_gclrTL);
02471 printf(" %3.0f ",trace_gclrBL);
02472 printf(" %3.0f ",trace_gclrTR);
02473 printf(" %3.0f ",trace_gclrBR);
02474 printf(" %3.0f\n", ipixel->gclrflt);
02475 printf(" ");
02476 printf(" %3.0f ",trace_bclrTL);
02477 printf(" %3.0f ",trace_bclrBL);
02478 printf(" %3.0f ",trace_bclrTR);
02479 printf(" %3.0f ",trace_bclrBR);
02480 printf(" %3.0f\n", ipixel->bclrflt);
02481 }
02482 #endif
02483 ;
02484 # ifndef SKIP_ERT
02485 if (iopc >= max_opacity) {
02486 ASSERT(ipixel->lnk == 0);
02487 ipixel->lnk = 1;
02488 }
02489 # endif
02490 };
02491 ipixel += 1;
02492 topRLEdata += 1 * voxel_istride;
02493 botRLEdata += 1 * voxel_istride;
02494 count--;
02495 SET_VOXELS_LOADED;
02496 }
02497 break;
02498 case ALL_NONZERO__TOP_NONZERO:
02499
02500
02501 if (!voxels_loaded) {
02502
02503
02504 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
02505 opacity = param0_table[opac_param];
02506 if (param1_size != 0) {
02507 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
02508 opacity *= param1_table[opac_param];
02509 if (param2_size != 0) {
02510 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
02511 opacity *= param2_table[opac_param];
02512 }
02513 }
02514 if (opacity > min_opacity) {
02515 opacity_int = opacity*255.;
02516 top_opc = opac_correct[opacity_int];
02517 } else {
02518 top_opc = (float)0.;
02519 };
02520
02521
02522 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
02523 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
02524
02525
02526
02527 top_rclr =
02528 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02529
02530 top_gclr =
02531 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02532
02533 top_bclr =
02534 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02535 ;
02536 ;
02537 ;
02538
02539
02540 top_rclr +=
02541 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02542
02543 top_gclr +=
02544 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02545
02546 top_bclr +=
02547 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02548 ;
02549 ;
02550 ;
02551 shade_factor = top_opc * slice_depth_cueing;
02552
02553 top_rclr *= shade_factor;
02554 top_gclr *= shade_factor;
02555 top_bclr *= shade_factor;
02556 ;
02557
02558
02559 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
02560 opacity = param0_table[opac_param];
02561 if (param1_size != 0) {
02562 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
02563 opacity *= param1_table[opac_param];
02564 if (param2_size != 0) {
02565 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
02566 opacity *= param2_table[opac_param];
02567 }
02568 }
02569 if (opacity > min_opacity) {
02570 opacity_int = opacity*255.;
02571 bot_opc = opac_correct[opacity_int];
02572 } else {
02573 bot_opc = (float)0.;
02574 };
02575
02576
02577 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
02578 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
02579
02580
02581
02582 bot_rclr =
02583 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02584
02585 bot_gclr =
02586 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02587
02588 bot_bclr =
02589 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02590 ;
02591 ;
02592 ;
02593
02594
02595 bot_rclr +=
02596 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02597
02598 bot_gclr +=
02599 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02600
02601 bot_bclr +=
02602 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02603 ;
02604 ;
02605 ;
02606 shade_factor = bot_opc * slice_depth_cueing;
02607
02608 bot_rclr *= shade_factor;
02609 bot_gclr *= shade_factor;
02610 bot_bclr *= shade_factor;
02611 ;
02612 }
02613
02614 #ifdef DEBUG
02615 if (ipixel == trace_pixel_ptr) {
02616 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02617 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02618 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02619 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02620 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02621 }
02622 #endif
02623 ;
02624
02625 acc_opc = top_opc * wgtTL;
02626
02627 acc_rclr = top_rclr * wgtTL;
02628 acc_gclr = top_gclr * wgtTL;
02629 acc_bclr = top_bclr * wgtTL;
02630
02631 #ifdef DEBUG
02632 if (ipixel == trace_pixel_ptr) {
02633 trace_opcTL = top_opc;
02634 trace_rclrTL = top_rclr;
02635 trace_gclrTL = top_gclr;
02636 trace_bclrTL = top_bclr;
02637
02638 }
02639 #endif
02640 ;
02641
02642 acc_opc += bot_opc * wgtBL;
02643
02644 acc_rclr += bot_rclr * wgtBL;
02645 acc_gclr += bot_gclr * wgtBL;
02646 acc_bclr += bot_bclr * wgtBL;
02647
02648 #ifdef DEBUG
02649 if (ipixel == trace_pixel_ptr) {
02650 trace_opcBL = bot_opc;
02651 trace_rclrBL = bot_rclr;
02652 trace_gclrBL = bot_gclr;
02653 trace_bclrBL = bot_bclr;
02654
02655 }
02656 #endif
02657 ;
02658
02659
02660 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
02661 opacity = param0_table[opac_param];
02662 if (param1_size != 0) {
02663 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
02664 opacity *= param1_table[opac_param];
02665 if (param2_size != 0) {
02666 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
02667 opacity *= param2_table[opac_param];
02668 }
02669 }
02670 if (opacity > min_opacity) {
02671 opacity_int = opacity*255.;
02672 top_opc = opac_correct[opacity_int];
02673 } else {
02674 top_opc = (float)0.;
02675 };
02676
02677
02678 shade_index=2*3*ShortField(topRLEdata,norm_offset);
02679 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
02680
02681
02682
02683 top_rclr =
02684 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02685
02686 top_gclr =
02687 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02688
02689 top_bclr =
02690 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02691 ;
02692 ;
02693 ;
02694
02695
02696 top_rclr +=
02697 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02698
02699 top_gclr +=
02700 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02701
02702 top_bclr +=
02703 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02704 ;
02705 ;
02706 ;
02707 shade_factor = top_opc * slice_depth_cueing;
02708
02709 top_rclr *= shade_factor;
02710 top_gclr *= shade_factor;
02711 top_bclr *= shade_factor;
02712 ;
02713
02714 acc_opc += top_opc * wgtTR;
02715
02716 acc_rclr += top_rclr * wgtTR;
02717 acc_gclr += top_gclr * wgtTR;
02718 acc_bclr += top_bclr * wgtTR;
02719
02720 #ifdef DEBUG
02721 if (ipixel == trace_pixel_ptr) {
02722 trace_opcTR = top_opc;
02723 trace_rclrTR = top_rclr;
02724 trace_gclrTR = top_gclr;
02725 trace_bclrTR = top_bclr;
02726
02727 }
02728 #endif
02729 ;
02730
02731 COUNT_RESAMPLE;
02732 if (acc_opc > min_opacity) {
02733 COUNT_COMPOSITE;
02734 iopc = ipixel->opcflt;
02735 # ifndef SKIP_ERT
02736 ASSERT(iopc < max_opacity);
02737 # endif
02738 iopc_inv = (float)1. - iopc;
02739
02740 ipixel->rclrflt += acc_rclr * iopc_inv;
02741 ipixel->gclrflt += acc_gclr * iopc_inv;
02742 ipixel->bclrflt += acc_bclr * iopc_inv;
02743 iopc += acc_opc * iopc_inv;
02744 ipixel->opcflt = iopc;
02745
02746 #ifdef DEBUG
02747 if (ipixel == trace_pixel_ptr) {
02748 #ifdef COMPUTE_SHADOW_BUFFER
02749 printf("{%3d} %3d %3d", k, icount-i-count, j);
02750 #else
02751 printf("[%3d] %3d %3d", k, icount-i-count, j);
02752 #endif
02753 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02754 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02755 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02756 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02757 printf(" %3.0f %3.0f\n", iopc*255.,
02758 ipixel->rclrflt);
02759
02760
02761 printf(" ");
02762 printf(" %3.0f ",trace_gclrTL);
02763 printf(" %3.0f ",trace_gclrBL);
02764 printf(" %3.0f ",trace_gclrTR);
02765 printf(" %3.0f ",trace_gclrBR);
02766 printf(" %3.0f\n", ipixel->gclrflt);
02767 printf(" ");
02768 printf(" %3.0f ",trace_bclrTL);
02769 printf(" %3.0f ",trace_bclrBL);
02770 printf(" %3.0f ",trace_bclrTR);
02771 printf(" %3.0f ",trace_bclrBR);
02772 printf(" %3.0f\n", ipixel->bclrflt);
02773 }
02774 #endif
02775 ;
02776 # ifndef SKIP_ERT
02777 if (iopc >= max_opacity) {
02778 ASSERT(ipixel->lnk == 0);
02779 ipixel->lnk = 1;
02780 }
02781 # endif
02782 };
02783 ipixel += 1;
02784 topRLEdata += 1 * voxel_istride;
02785 botRLEdata += 1 * voxel_istride;
02786 count--;
02787 SET_VOXELS_LOADED;
02788
02789
02790
02791 while (count > 0) {
02792 if (PIXEL_IS_OPAQUE(ipixel))
02793 break;
02794 if (!voxels_loaded) {
02795
02796
02797 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
02798 opacity = param0_table[opac_param];
02799 if (param1_size != 0) {
02800 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
02801 opacity *= param1_table[opac_param];
02802 if (param2_size != 0) {
02803 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
02804 opacity *= param2_table[opac_param];
02805 }
02806 }
02807 if (opacity > min_opacity) {
02808 opacity_int = opacity*255.;
02809 top_opc = opac_correct[opacity_int];
02810 } else {
02811 top_opc = (float)0.;
02812 };
02813
02814
02815 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
02816 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
02817
02818
02819
02820 top_rclr =
02821 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02822
02823 top_gclr =
02824 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02825
02826 top_bclr =
02827 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02828 ;
02829 ;
02830 ;
02831
02832
02833 top_rclr +=
02834 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02835
02836 top_gclr +=
02837 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02838
02839 top_bclr +=
02840 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02841 ;
02842 ;
02843 ;
02844 shade_factor = top_opc * slice_depth_cueing;
02845
02846 top_rclr *= shade_factor;
02847 top_gclr *= shade_factor;
02848 top_bclr *= shade_factor;
02849 ;
02850 }
02851
02852 #ifdef DEBUG
02853 if (ipixel == trace_pixel_ptr) {
02854 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
02855 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
02856 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
02857 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
02858 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
02859 }
02860 #endif
02861 ;
02862
02863 acc_opc = top_opc * wgtTL;
02864
02865 acc_rclr = top_rclr * wgtTL;
02866 acc_gclr = top_gclr * wgtTL;
02867 acc_bclr = top_bclr * wgtTL;
02868
02869 #ifdef DEBUG
02870 if (ipixel == trace_pixel_ptr) {
02871 trace_opcTL = top_opc;
02872 trace_rclrTL = top_rclr;
02873 trace_gclrTL = top_gclr;
02874 trace_bclrTL = top_bclr;
02875
02876 }
02877 #endif
02878 ;
02879
02880
02881 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
02882 opacity = param0_table[opac_param];
02883 if (param1_size != 0) {
02884 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
02885 opacity *= param1_table[opac_param];
02886 if (param2_size != 0) {
02887 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
02888 opacity *= param2_table[opac_param];
02889 }
02890 }
02891 if (opacity > min_opacity) {
02892 opacity_int = opacity*255.;
02893 top_opc = opac_correct[opacity_int];
02894 } else {
02895 top_opc = (float)0.;
02896 };
02897
02898
02899 shade_index=2*3*ShortField(topRLEdata,norm_offset);
02900 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
02901
02902
02903
02904 top_rclr =
02905 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
02906
02907 top_gclr =
02908 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
02909
02910 top_bclr =
02911 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
02912 ;
02913 ;
02914 ;
02915
02916
02917 top_rclr +=
02918 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
02919
02920 top_gclr +=
02921 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
02922
02923 top_bclr +=
02924 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
02925 ;
02926 ;
02927 ;
02928 shade_factor = top_opc * slice_depth_cueing;
02929
02930 top_rclr *= shade_factor;
02931 top_gclr *= shade_factor;
02932 top_bclr *= shade_factor;
02933 ;
02934
02935 acc_opc += top_opc * wgtTR;
02936
02937 acc_rclr += top_rclr * wgtTR;
02938 acc_gclr += top_gclr * wgtTR;
02939 acc_bclr += top_bclr * wgtTR;
02940
02941 #ifdef DEBUG
02942 if (ipixel == trace_pixel_ptr) {
02943 trace_opcTR = top_opc;
02944 trace_rclrTR = top_rclr;
02945 trace_gclrTR = top_gclr;
02946 trace_bclrTR = top_bclr;
02947
02948 }
02949 #endif
02950 ;
02951
02952 COUNT_RESAMPLE;
02953 if (acc_opc > min_opacity) {
02954 COUNT_COMPOSITE;
02955 iopc = ipixel->opcflt;
02956 # ifndef SKIP_ERT
02957 ASSERT(iopc < max_opacity);
02958 # endif
02959 iopc_inv = (float)1. - iopc;
02960
02961 ipixel->rclrflt += acc_rclr * iopc_inv;
02962 ipixel->gclrflt += acc_gclr * iopc_inv;
02963 ipixel->bclrflt += acc_bclr * iopc_inv;
02964 iopc += acc_opc * iopc_inv;
02965 ipixel->opcflt = iopc;
02966
02967 #ifdef DEBUG
02968 if (ipixel == trace_pixel_ptr) {
02969 #ifdef COMPUTE_SHADOW_BUFFER
02970 printf("{%3d} %3d %3d", k, icount-i-count, j);
02971 #else
02972 printf("[%3d] %3d %3d", k, icount-i-count, j);
02973 #endif
02974 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
02975 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
02976 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
02977 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
02978 printf(" %3.0f %3.0f\n", iopc*255.,
02979 ipixel->rclrflt);
02980
02981
02982 printf(" ");
02983 printf(" %3.0f ",trace_gclrTL);
02984 printf(" %3.0f ",trace_gclrBL);
02985 printf(" %3.0f ",trace_gclrTR);
02986 printf(" %3.0f ",trace_gclrBR);
02987 printf(" %3.0f\n", ipixel->gclrflt);
02988 printf(" ");
02989 printf(" %3.0f ",trace_bclrTL);
02990 printf(" %3.0f ",trace_bclrBL);
02991 printf(" %3.0f ",trace_bclrTR);
02992 printf(" %3.0f ",trace_bclrBR);
02993 printf(" %3.0f\n", ipixel->bclrflt);
02994 }
02995 #endif
02996 ;
02997 # ifndef SKIP_ERT
02998 if (iopc >= max_opacity) {
02999 ASSERT(ipixel->lnk == 0);
03000 ipixel->lnk = 1;
03001 }
03002 # endif
03003 };
03004 ipixel += 1;
03005 topRLEdata += 1 * voxel_istride;
03006 botRLEdata += 1 * voxel_istride;
03007 count--;
03008 SET_VOXELS_LOADED;
03009 }
03010 break;
03011 case ALL_ZERO__BOT_NONZERO:
03012
03013
03014
03015 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
03016 opacity = param0_table[opac_param];
03017 if (param1_size != 0) {
03018 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
03019 opacity *= param1_table[opac_param];
03020 if (param2_size != 0) {
03021 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
03022 opacity *= param2_table[opac_param];
03023 }
03024 }
03025 if (opacity > min_opacity) {
03026 opacity_int = opacity*255.;
03027 bot_opc = opac_correct[opacity_int];
03028 } else {
03029 bot_opc = (float)0.;
03030 };
03031
03032
03033 shade_index=2*3*ShortField(botRLEdata,norm_offset);
03034 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
03035
03036
03037
03038 bot_rclr =
03039 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03040
03041 bot_gclr =
03042 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03043
03044 bot_bclr =
03045 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03046 ;
03047 ;
03048 ;
03049
03050
03051 bot_rclr +=
03052 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03053
03054 bot_gclr +=
03055 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03056
03057 bot_bclr +=
03058 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03059 ;
03060 ;
03061 ;
03062 shade_factor = bot_opc * slice_depth_cueing;
03063
03064 bot_rclr *= shade_factor;
03065 bot_gclr *= shade_factor;
03066 bot_bclr *= shade_factor;
03067 ;
03068
03069 #ifdef DEBUG
03070 if (ipixel == trace_pixel_ptr) {
03071 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03072 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03073 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03074 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03075 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03076 }
03077 #endif
03078 ;
03079
03080 acc_opc = bot_opc * wgtBR;
03081
03082 acc_rclr = bot_rclr * wgtBR;
03083 acc_gclr = bot_gclr * wgtBR;
03084 acc_bclr = bot_bclr * wgtBR;
03085
03086 #ifdef DEBUG
03087 if (ipixel == trace_pixel_ptr) {
03088 trace_opcBR = bot_opc;
03089 trace_rclrBR = bot_rclr;
03090 trace_gclrBR = bot_gclr;
03091 trace_bclrBR = bot_bclr;
03092
03093 }
03094 #endif
03095 ;
03096
03097 COUNT_RESAMPLE;
03098 if (acc_opc > min_opacity) {
03099 COUNT_COMPOSITE;
03100 iopc = ipixel->opcflt;
03101 # ifndef SKIP_ERT
03102 ASSERT(iopc < max_opacity);
03103 # endif
03104 iopc_inv = (float)1. - iopc;
03105
03106 ipixel->rclrflt += acc_rclr * iopc_inv;
03107 ipixel->gclrflt += acc_gclr * iopc_inv;
03108 ipixel->bclrflt += acc_bclr * iopc_inv;
03109 iopc += acc_opc * iopc_inv;
03110 ipixel->opcflt = iopc;
03111
03112 #ifdef DEBUG
03113 if (ipixel == trace_pixel_ptr) {
03114 #ifdef COMPUTE_SHADOW_BUFFER
03115 printf("{%3d} %3d %3d", k, icount-i-count, j);
03116 #else
03117 printf("[%3d] %3d %3d", k, icount-i-count, j);
03118 #endif
03119 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03120 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03121 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03122 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03123 printf(" %3.0f %3.0f\n", iopc*255.,
03124 ipixel->rclrflt);
03125
03126
03127 printf(" ");
03128 printf(" %3.0f ",trace_gclrTL);
03129 printf(" %3.0f ",trace_gclrBL);
03130 printf(" %3.0f ",trace_gclrTR);
03131 printf(" %3.0f ",trace_gclrBR);
03132 printf(" %3.0f\n", ipixel->gclrflt);
03133 printf(" ");
03134 printf(" %3.0f ",trace_bclrTL);
03135 printf(" %3.0f ",trace_bclrBL);
03136 printf(" %3.0f ",trace_bclrTR);
03137 printf(" %3.0f ",trace_bclrBR);
03138 printf(" %3.0f\n", ipixel->bclrflt);
03139 }
03140 #endif
03141 ;
03142 # ifndef SKIP_ERT
03143 if (iopc >= max_opacity) {
03144 ASSERT(ipixel->lnk == 0);
03145 ipixel->lnk = 1;
03146 }
03147 # endif
03148 };
03149 ipixel += 1;
03150 topRLEdata += 1 * voxel_istride;
03151 botRLEdata += 1 * voxel_istride;
03152 count--;
03153 SET_VOXELS_LOADED;
03154
03155
03156
03157 while (count > 0) {
03158 if (PIXEL_IS_OPAQUE(ipixel))
03159 break;
03160 if (!voxels_loaded) {
03161
03162
03163 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
03164 opacity = param0_table[opac_param];
03165 if (param1_size != 0) {
03166 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
03167 opacity *= param1_table[opac_param];
03168 if (param2_size != 0) {
03169 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
03170 opacity *= param2_table[opac_param];
03171 }
03172 }
03173 if (opacity > min_opacity) {
03174 opacity_int = opacity*255.;
03175 bot_opc = opac_correct[opacity_int];
03176 } else {
03177 bot_opc = (float)0.;
03178 };
03179
03180
03181 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
03182 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
03183
03184
03185
03186 bot_rclr =
03187 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03188
03189 bot_gclr =
03190 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03191
03192 bot_bclr =
03193 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03194 ;
03195 ;
03196 ;
03197
03198
03199 bot_rclr +=
03200 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03201
03202 bot_gclr +=
03203 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03204
03205 bot_bclr +=
03206 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03207 ;
03208 ;
03209 ;
03210 shade_factor = bot_opc * slice_depth_cueing;
03211
03212 bot_rclr *= shade_factor;
03213 bot_gclr *= shade_factor;
03214 bot_bclr *= shade_factor;
03215 ;
03216 }
03217
03218 #ifdef DEBUG
03219 if (ipixel == trace_pixel_ptr) {
03220 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03221 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03222 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03223 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03224 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03225 }
03226 #endif
03227 ;
03228
03229 acc_opc = bot_opc * wgtBL;
03230
03231 acc_rclr = bot_rclr * wgtBL;
03232 acc_gclr = bot_gclr * wgtBL;
03233 acc_bclr = bot_bclr * wgtBL;
03234
03235 #ifdef DEBUG
03236 if (ipixel == trace_pixel_ptr) {
03237 trace_opcBL = bot_opc;
03238 trace_rclrBL = bot_rclr;
03239 trace_gclrBL = bot_gclr;
03240 trace_bclrBL = bot_bclr;
03241
03242 }
03243 #endif
03244 ;
03245
03246
03247 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
03248 opacity = param0_table[opac_param];
03249 if (param1_size != 0) {
03250 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
03251 opacity *= param1_table[opac_param];
03252 if (param2_size != 0) {
03253 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
03254 opacity *= param2_table[opac_param];
03255 }
03256 }
03257 if (opacity > min_opacity) {
03258 opacity_int = opacity*255.;
03259 bot_opc = opac_correct[opacity_int];
03260 } else {
03261 bot_opc = (float)0.;
03262 };
03263
03264
03265 shade_index=2*3*ShortField(botRLEdata,norm_offset);
03266 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
03267
03268
03269
03270 bot_rclr =
03271 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03272
03273 bot_gclr =
03274 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03275
03276 bot_bclr =
03277 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03278 ;
03279 ;
03280 ;
03281
03282
03283 bot_rclr +=
03284 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03285
03286 bot_gclr +=
03287 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03288
03289 bot_bclr +=
03290 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03291 ;
03292 ;
03293 ;
03294 shade_factor = bot_opc * slice_depth_cueing;
03295
03296 bot_rclr *= shade_factor;
03297 bot_gclr *= shade_factor;
03298 bot_bclr *= shade_factor;
03299 ;
03300
03301 acc_opc += bot_opc * wgtBR;
03302
03303 acc_rclr += bot_rclr * wgtBR;
03304 acc_gclr += bot_gclr * wgtBR;
03305 acc_bclr += bot_bclr * wgtBR;
03306
03307 #ifdef DEBUG
03308 if (ipixel == trace_pixel_ptr) {
03309 trace_opcBR = bot_opc;
03310 trace_rclrBR = bot_rclr;
03311 trace_gclrBR = bot_gclr;
03312 trace_bclrBR = bot_bclr;
03313
03314 }
03315 #endif
03316 ;
03317
03318 COUNT_RESAMPLE;
03319 if (acc_opc > min_opacity) {
03320 COUNT_COMPOSITE;
03321 iopc = ipixel->opcflt;
03322 # ifndef SKIP_ERT
03323 ASSERT(iopc < max_opacity);
03324 # endif
03325 iopc_inv = (float)1. - iopc;
03326
03327 ipixel->rclrflt += acc_rclr * iopc_inv;
03328 ipixel->gclrflt += acc_gclr * iopc_inv;
03329 ipixel->bclrflt += acc_bclr * iopc_inv;
03330 iopc += acc_opc * iopc_inv;
03331 ipixel->opcflt = iopc;
03332
03333 #ifdef DEBUG
03334 if (ipixel == trace_pixel_ptr) {
03335 #ifdef COMPUTE_SHADOW_BUFFER
03336 printf("{%3d} %3d %3d", k, icount-i-count, j);
03337 #else
03338 printf("[%3d] %3d %3d", k, icount-i-count, j);
03339 #endif
03340 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03341 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03342 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03343 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03344 printf(" %3.0f %3.0f\n", iopc*255.,
03345 ipixel->rclrflt);
03346
03347
03348 printf(" ");
03349 printf(" %3.0f ",trace_gclrTL);
03350 printf(" %3.0f ",trace_gclrBL);
03351 printf(" %3.0f ",trace_gclrTR);
03352 printf(" %3.0f ",trace_gclrBR);
03353 printf(" %3.0f\n", ipixel->gclrflt);
03354 printf(" ");
03355 printf(" %3.0f ",trace_bclrTL);
03356 printf(" %3.0f ",trace_bclrBL);
03357 printf(" %3.0f ",trace_bclrTR);
03358 printf(" %3.0f ",trace_bclrBR);
03359 printf(" %3.0f\n", ipixel->bclrflt);
03360 }
03361 #endif
03362 ;
03363 # ifndef SKIP_ERT
03364 if (iopc >= max_opacity) {
03365 ASSERT(ipixel->lnk == 0);
03366 ipixel->lnk = 1;
03367 }
03368 # endif
03369 };
03370 ipixel += 1;
03371 topRLEdata += 1 * voxel_istride;
03372 botRLEdata += 1 * voxel_istride;
03373 count--;
03374 SET_VOXELS_LOADED;
03375 }
03376 break;
03377 case TOP_NONZERO__BOT_NONZERO:
03378
03379 if (!voxels_loaded) {
03380
03381
03382 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
03383 opacity = param0_table[opac_param];
03384 if (param1_size != 0) {
03385 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
03386 opacity *= param1_table[opac_param];
03387 if (param2_size != 0) {
03388 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
03389 opacity *= param2_table[opac_param];
03390 }
03391 }
03392 if (opacity > min_opacity) {
03393 opacity_int = opacity*255.;
03394 top_opc = opac_correct[opacity_int];
03395 } else {
03396 top_opc = (float)0.;
03397 };
03398
03399
03400 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
03401 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
03402
03403
03404
03405 top_rclr =
03406 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03407
03408 top_gclr =
03409 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03410
03411 top_bclr =
03412 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03413 ;
03414 ;
03415 ;
03416
03417
03418 top_rclr +=
03419 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03420
03421 top_gclr +=
03422 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03423
03424 top_bclr +=
03425 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03426 ;
03427 ;
03428 ;
03429 shade_factor = top_opc * slice_depth_cueing;
03430
03431 top_rclr *= shade_factor;
03432 top_gclr *= shade_factor;
03433 top_bclr *= shade_factor;
03434 ;
03435 }
03436
03437 #ifdef DEBUG
03438 if (ipixel == trace_pixel_ptr) {
03439 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03440 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03441 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03442 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03443 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03444 }
03445 #endif
03446 ;
03447
03448 acc_opc = top_opc * wgtTL;
03449
03450 acc_rclr = top_rclr * wgtTL;
03451 acc_gclr = top_gclr * wgtTL;
03452 acc_bclr = top_bclr * wgtTL;
03453
03454 #ifdef DEBUG
03455 if (ipixel == trace_pixel_ptr) {
03456 trace_opcTL = top_opc;
03457 trace_rclrTL = top_rclr;
03458 trace_gclrTL = top_gclr;
03459 trace_bclrTL = top_bclr;
03460
03461 }
03462 #endif
03463 ;
03464
03465
03466 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
03467 opacity = param0_table[opac_param];
03468 if (param1_size != 0) {
03469 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
03470 opacity *= param1_table[opac_param];
03471 if (param2_size != 0) {
03472 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
03473 opacity *= param2_table[opac_param];
03474 }
03475 }
03476 if (opacity > min_opacity) {
03477 opacity_int = opacity*255.;
03478 bot_opc = opac_correct[opacity_int];
03479 } else {
03480 bot_opc = (float)0.;
03481 };
03482
03483
03484 shade_index=2*3*ShortField(botRLEdata,norm_offset);
03485 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
03486
03487
03488
03489 bot_rclr =
03490 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03491
03492 bot_gclr =
03493 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03494
03495 bot_bclr =
03496 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03497 ;
03498 ;
03499 ;
03500
03501
03502 bot_rclr +=
03503 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03504
03505 bot_gclr +=
03506 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03507
03508 bot_bclr +=
03509 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03510 ;
03511 ;
03512 ;
03513 shade_factor = bot_opc * slice_depth_cueing;
03514
03515 bot_rclr *= shade_factor;
03516 bot_gclr *= shade_factor;
03517 bot_bclr *= shade_factor;
03518 ;
03519
03520 acc_opc += bot_opc * wgtBR;
03521
03522 acc_rclr += bot_rclr * wgtBR;
03523 acc_gclr += bot_gclr * wgtBR;
03524 acc_bclr += bot_bclr * wgtBR;
03525
03526 #ifdef DEBUG
03527 if (ipixel == trace_pixel_ptr) {
03528 trace_opcBR = bot_opc;
03529 trace_rclrBR = bot_rclr;
03530 trace_gclrBR = bot_gclr;
03531 trace_bclrBR = bot_bclr;
03532
03533 }
03534 #endif
03535 ;
03536
03537 COUNT_RESAMPLE;
03538 if (acc_opc > min_opacity) {
03539 COUNT_COMPOSITE;
03540 iopc = ipixel->opcflt;
03541 # ifndef SKIP_ERT
03542 ASSERT(iopc < max_opacity);
03543 # endif
03544 iopc_inv = (float)1. - iopc;
03545
03546 ipixel->rclrflt += acc_rclr * iopc_inv;
03547 ipixel->gclrflt += acc_gclr * iopc_inv;
03548 ipixel->bclrflt += acc_bclr * iopc_inv;
03549 iopc += acc_opc * iopc_inv;
03550 ipixel->opcflt = iopc;
03551
03552 #ifdef DEBUG
03553 if (ipixel == trace_pixel_ptr) {
03554 #ifdef COMPUTE_SHADOW_BUFFER
03555 printf("{%3d} %3d %3d", k, icount-i-count, j);
03556 #else
03557 printf("[%3d] %3d %3d", k, icount-i-count, j);
03558 #endif
03559 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03560 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03561 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03562 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03563 printf(" %3.0f %3.0f\n", iopc*255.,
03564 ipixel->rclrflt);
03565
03566
03567 printf(" ");
03568 printf(" %3.0f ",trace_gclrTL);
03569 printf(" %3.0f ",trace_gclrBL);
03570 printf(" %3.0f ",trace_gclrTR);
03571 printf(" %3.0f ",trace_gclrBR);
03572 printf(" %3.0f\n", ipixel->gclrflt);
03573 printf(" ");
03574 printf(" %3.0f ",trace_bclrTL);
03575 printf(" %3.0f ",trace_bclrBL);
03576 printf(" %3.0f ",trace_bclrTR);
03577 printf(" %3.0f ",trace_bclrBR);
03578 printf(" %3.0f\n", ipixel->bclrflt);
03579 }
03580 #endif
03581 ;
03582 # ifndef SKIP_ERT
03583 if (iopc >= max_opacity) {
03584 ASSERT(ipixel->lnk == 0);
03585 ipixel->lnk = 1;
03586 }
03587 # endif
03588 };
03589 ipixel += 1;
03590 topRLEdata += 1 * voxel_istride;
03591 botRLEdata += 1 * voxel_istride;
03592 count--;
03593 SET_VOXELS_LOADED;
03594
03595
03596
03597 while (count > 0) {
03598 if (PIXEL_IS_OPAQUE(ipixel))
03599 break;
03600 if (!voxels_loaded) {
03601
03602
03603 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
03604 opacity = param0_table[opac_param];
03605 if (param1_size != 0) {
03606 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
03607 opacity *= param1_table[opac_param];
03608 if (param2_size != 0) {
03609 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
03610 opacity *= param2_table[opac_param];
03611 }
03612 }
03613 if (opacity > min_opacity) {
03614 opacity_int = opacity*255.;
03615 bot_opc = opac_correct[opacity_int];
03616 } else {
03617 bot_opc = (float)0.;
03618 };
03619
03620
03621 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
03622 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
03623
03624
03625
03626 bot_rclr =
03627 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03628
03629 bot_gclr =
03630 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03631
03632 bot_bclr =
03633 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03634 ;
03635 ;
03636 ;
03637
03638
03639 bot_rclr +=
03640 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03641
03642 bot_gclr +=
03643 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03644
03645 bot_bclr +=
03646 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03647 ;
03648 ;
03649 ;
03650 shade_factor = bot_opc * slice_depth_cueing;
03651
03652 bot_rclr *= shade_factor;
03653 bot_gclr *= shade_factor;
03654 bot_bclr *= shade_factor;
03655 ;
03656 }
03657
03658 #ifdef DEBUG
03659 if (ipixel == trace_pixel_ptr) {
03660 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03661 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03662 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03663 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03664 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03665 }
03666 #endif
03667 ;
03668
03669 acc_opc = bot_opc * wgtBL;
03670
03671 acc_rclr = bot_rclr * wgtBL;
03672 acc_gclr = bot_gclr * wgtBL;
03673 acc_bclr = bot_bclr * wgtBL;
03674
03675 #ifdef DEBUG
03676 if (ipixel == trace_pixel_ptr) {
03677 trace_opcBL = bot_opc;
03678 trace_rclrBL = bot_rclr;
03679 trace_gclrBL = bot_gclr;
03680 trace_bclrBL = bot_bclr;
03681
03682 }
03683 #endif
03684 ;
03685
03686
03687 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
03688 opacity = param0_table[opac_param];
03689 if (param1_size != 0) {
03690 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
03691 opacity *= param1_table[opac_param];
03692 if (param2_size != 0) {
03693 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
03694 opacity *= param2_table[opac_param];
03695 }
03696 }
03697 if (opacity > min_opacity) {
03698 opacity_int = opacity*255.;
03699 bot_opc = opac_correct[opacity_int];
03700 } else {
03701 bot_opc = (float)0.;
03702 };
03703
03704
03705 shade_index=2*3*ShortField(botRLEdata,norm_offset);
03706 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
03707
03708
03709
03710 bot_rclr =
03711 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03712
03713 bot_gclr =
03714 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03715
03716 bot_bclr =
03717 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03718 ;
03719 ;
03720 ;
03721
03722
03723 bot_rclr +=
03724 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03725
03726 bot_gclr +=
03727 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03728
03729 bot_bclr +=
03730 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03731 ;
03732 ;
03733 ;
03734 shade_factor = bot_opc * slice_depth_cueing;
03735
03736 bot_rclr *= shade_factor;
03737 bot_gclr *= shade_factor;
03738 bot_bclr *= shade_factor;
03739 ;
03740
03741 acc_opc += bot_opc * wgtBR;
03742
03743 acc_rclr += bot_rclr * wgtBR;
03744 acc_gclr += bot_gclr * wgtBR;
03745 acc_bclr += bot_bclr * wgtBR;
03746
03747 #ifdef DEBUG
03748 if (ipixel == trace_pixel_ptr) {
03749 trace_opcBR = bot_opc;
03750 trace_rclrBR = bot_rclr;
03751 trace_gclrBR = bot_gclr;
03752 trace_bclrBR = bot_bclr;
03753
03754 }
03755 #endif
03756 ;
03757
03758 COUNT_RESAMPLE;
03759 if (acc_opc > min_opacity) {
03760 COUNT_COMPOSITE;
03761 iopc = ipixel->opcflt;
03762 # ifndef SKIP_ERT
03763 ASSERT(iopc < max_opacity);
03764 # endif
03765 iopc_inv = (float)1. - iopc;
03766
03767 ipixel->rclrflt += acc_rclr * iopc_inv;
03768 ipixel->gclrflt += acc_gclr * iopc_inv;
03769 ipixel->bclrflt += acc_bclr * iopc_inv;
03770 iopc += acc_opc * iopc_inv;
03771 ipixel->opcflt = iopc;
03772
03773 #ifdef DEBUG
03774 if (ipixel == trace_pixel_ptr) {
03775 #ifdef COMPUTE_SHADOW_BUFFER
03776 printf("{%3d} %3d %3d", k, icount-i-count, j);
03777 #else
03778 printf("[%3d] %3d %3d", k, icount-i-count, j);
03779 #endif
03780 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
03781 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
03782 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
03783 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
03784 printf(" %3.0f %3.0f\n", iopc*255.,
03785 ipixel->rclrflt);
03786
03787
03788 printf(" ");
03789 printf(" %3.0f ",trace_gclrTL);
03790 printf(" %3.0f ",trace_gclrBL);
03791 printf(" %3.0f ",trace_gclrTR);
03792 printf(" %3.0f ",trace_gclrBR);
03793 printf(" %3.0f\n", ipixel->gclrflt);
03794 printf(" ");
03795 printf(" %3.0f ",trace_bclrTL);
03796 printf(" %3.0f ",trace_bclrBL);
03797 printf(" %3.0f ",trace_bclrTR);
03798 printf(" %3.0f ",trace_bclrBR);
03799 printf(" %3.0f\n", ipixel->bclrflt);
03800 }
03801 #endif
03802 ;
03803 # ifndef SKIP_ERT
03804 if (iopc >= max_opacity) {
03805 ASSERT(ipixel->lnk == 0);
03806 ipixel->lnk = 1;
03807 }
03808 # endif
03809 };
03810 ipixel += 1;
03811 topRLEdata += 1 * voxel_istride;
03812 botRLEdata += 1 * voxel_istride;
03813 count--;
03814 SET_VOXELS_LOADED;
03815 }
03816 break;
03817 case BOT_NONZERO__BOT_NONZERO:
03818
03819
03820 while (count > 0) {
03821 if (PIXEL_IS_OPAQUE(ipixel))
03822 break;
03823 if (!voxels_loaded) {
03824
03825
03826 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
03827 opacity = param0_table[opac_param];
03828 if (param1_size != 0) {
03829 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
03830 opacity *= param1_table[opac_param];
03831 if (param2_size != 0) {
03832 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
03833 opacity *= param2_table[opac_param];
03834 }
03835 }
03836 if (opacity > min_opacity) {
03837 opacity_int = opacity*255.;
03838 bot_opc = opac_correct[opacity_int];
03839 } else {
03840 bot_opc = (float)0.;
03841 };
03842
03843
03844 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
03845 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
03846
03847
03848
03849 bot_rclr =
03850 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03851
03852 bot_gclr =
03853 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03854
03855 bot_bclr =
03856 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03857 ;
03858 ;
03859 ;
03860
03861
03862 bot_rclr +=
03863 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03864
03865 bot_gclr +=
03866 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03867
03868 bot_bclr +=
03869 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03870 ;
03871 ;
03872 ;
03873 shade_factor = bot_opc * slice_depth_cueing;
03874
03875 bot_rclr *= shade_factor;
03876 bot_gclr *= shade_factor;
03877 bot_bclr *= shade_factor;
03878 ;
03879 }
03880
03881 #ifdef DEBUG
03882 if (ipixel == trace_pixel_ptr) {
03883 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
03884 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
03885 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
03886 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
03887 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
03888 }
03889 #endif
03890 ;
03891
03892 acc_opc = bot_opc * wgtBL;
03893
03894 acc_rclr = bot_rclr * wgtBL;
03895 acc_gclr = bot_gclr * wgtBL;
03896 acc_bclr = bot_bclr * wgtBL;
03897
03898 #ifdef DEBUG
03899 if (ipixel == trace_pixel_ptr) {
03900 trace_opcBL = bot_opc;
03901 trace_rclrBL = bot_rclr;
03902 trace_gclrBL = bot_gclr;
03903 trace_bclrBL = bot_bclr;
03904
03905 }
03906 #endif
03907 ;
03908
03909
03910 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
03911 opacity = param0_table[opac_param];
03912 if (param1_size != 0) {
03913 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
03914 opacity *= param1_table[opac_param];
03915 if (param2_size != 0) {
03916 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
03917 opacity *= param2_table[opac_param];
03918 }
03919 }
03920 if (opacity > min_opacity) {
03921 opacity_int = opacity*255.;
03922 bot_opc = opac_correct[opacity_int];
03923 } else {
03924 bot_opc = (float)0.;
03925 };
03926
03927
03928 shade_index=2*3*ShortField(botRLEdata,norm_offset);
03929 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
03930
03931
03932
03933 bot_rclr =
03934 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
03935
03936 bot_gclr =
03937 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
03938
03939 bot_bclr =
03940 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
03941 ;
03942 ;
03943 ;
03944
03945
03946 bot_rclr +=
03947 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
03948
03949 bot_gclr +=
03950 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
03951
03952 bot_bclr +=
03953 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
03954 ;
03955 ;
03956 ;
03957 shade_factor = bot_opc * slice_depth_cueing;
03958
03959 bot_rclr *= shade_factor;
03960 bot_gclr *= shade_factor;
03961 bot_bclr *= shade_factor;
03962 ;
03963
03964 acc_opc += bot_opc * wgtBR;
03965
03966 acc_rclr += bot_rclr * wgtBR;
03967 acc_gclr += bot_gclr * wgtBR;
03968 acc_bclr += bot_bclr * wgtBR;
03969
03970 #ifdef DEBUG
03971 if (ipixel == trace_pixel_ptr) {
03972 trace_opcBR = bot_opc;
03973 trace_rclrBR = bot_rclr;
03974 trace_gclrBR = bot_gclr;
03975 trace_bclrBR = bot_bclr;
03976
03977 }
03978 #endif
03979 ;
03980
03981 COUNT_RESAMPLE;
03982 if (acc_opc > min_opacity) {
03983 COUNT_COMPOSITE;
03984 iopc = ipixel->opcflt;
03985 # ifndef SKIP_ERT
03986 ASSERT(iopc < max_opacity);
03987 # endif
03988 iopc_inv = (float)1. - iopc;
03989
03990 ipixel->rclrflt += acc_rclr * iopc_inv;
03991 ipixel->gclrflt += acc_gclr * iopc_inv;
03992 ipixel->bclrflt += acc_bclr * iopc_inv;
03993 iopc += acc_opc * iopc_inv;
03994 ipixel->opcflt = iopc;
03995
03996 #ifdef DEBUG
03997 if (ipixel == trace_pixel_ptr) {
03998 #ifdef COMPUTE_SHADOW_BUFFER
03999 printf("{%3d} %3d %3d", k, icount-i-count, j);
04000 #else
04001 printf("[%3d] %3d %3d", k, icount-i-count, j);
04002 #endif
04003 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04004 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04005 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04006 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04007 printf(" %3.0f %3.0f\n", iopc*255.,
04008 ipixel->rclrflt);
04009
04010
04011 printf(" ");
04012 printf(" %3.0f ",trace_gclrTL);
04013 printf(" %3.0f ",trace_gclrBL);
04014 printf(" %3.0f ",trace_gclrTR);
04015 printf(" %3.0f ",trace_gclrBR);
04016 printf(" %3.0f\n", ipixel->gclrflt);
04017 printf(" ");
04018 printf(" %3.0f ",trace_bclrTL);
04019 printf(" %3.0f ",trace_bclrBL);
04020 printf(" %3.0f ",trace_bclrTR);
04021 printf(" %3.0f ",trace_bclrBR);
04022 printf(" %3.0f\n", ipixel->bclrflt);
04023 }
04024 #endif
04025 ;
04026 # ifndef SKIP_ERT
04027 if (iopc >= max_opacity) {
04028 ASSERT(ipixel->lnk == 0);
04029 ipixel->lnk = 1;
04030 }
04031 # endif
04032 };
04033 ipixel += 1;
04034 topRLEdata += 1 * voxel_istride;
04035 botRLEdata += 1 * voxel_istride;
04036 count--;
04037 SET_VOXELS_LOADED;
04038 }
04039 break;
04040 case ALL_NONZERO__BOT_NONZERO:
04041
04042
04043 if (!voxels_loaded) {
04044
04045
04046 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
04047 opacity = param0_table[opac_param];
04048 if (param1_size != 0) {
04049 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
04050 opacity *= param1_table[opac_param];
04051 if (param2_size != 0) {
04052 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
04053 opacity *= param2_table[opac_param];
04054 }
04055 }
04056 if (opacity > min_opacity) {
04057 opacity_int = opacity*255.;
04058 top_opc = opac_correct[opacity_int];
04059 } else {
04060 top_opc = (float)0.;
04061 };
04062
04063
04064 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
04065 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
04066
04067
04068
04069 top_rclr =
04070 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04071
04072 top_gclr =
04073 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04074
04075 top_bclr =
04076 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04077 ;
04078 ;
04079 ;
04080
04081
04082 top_rclr +=
04083 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04084
04085 top_gclr +=
04086 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04087
04088 top_bclr +=
04089 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04090 ;
04091 ;
04092 ;
04093 shade_factor = top_opc * slice_depth_cueing;
04094
04095 top_rclr *= shade_factor;
04096 top_gclr *= shade_factor;
04097 top_bclr *= shade_factor;
04098 ;
04099
04100
04101 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
04102 opacity = param0_table[opac_param];
04103 if (param1_size != 0) {
04104 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
04105 opacity *= param1_table[opac_param];
04106 if (param2_size != 0) {
04107 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
04108 opacity *= param2_table[opac_param];
04109 }
04110 }
04111 if (opacity > min_opacity) {
04112 opacity_int = opacity*255.;
04113 bot_opc = opac_correct[opacity_int];
04114 } else {
04115 bot_opc = (float)0.;
04116 };
04117
04118
04119 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
04120 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
04121
04122
04123
04124 bot_rclr =
04125 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04126
04127 bot_gclr =
04128 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04129
04130 bot_bclr =
04131 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04132 ;
04133 ;
04134 ;
04135
04136
04137 bot_rclr +=
04138 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04139
04140 bot_gclr +=
04141 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04142
04143 bot_bclr +=
04144 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04145 ;
04146 ;
04147 ;
04148 shade_factor = bot_opc * slice_depth_cueing;
04149
04150 bot_rclr *= shade_factor;
04151 bot_gclr *= shade_factor;
04152 bot_bclr *= shade_factor;
04153 ;
04154 }
04155
04156 #ifdef DEBUG
04157 if (ipixel == trace_pixel_ptr) {
04158 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04159 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04160 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04161 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04162 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04163 }
04164 #endif
04165 ;
04166
04167 acc_opc = top_opc * wgtTL;
04168
04169 acc_rclr = top_rclr * wgtTL;
04170 acc_gclr = top_gclr * wgtTL;
04171 acc_bclr = top_bclr * wgtTL;
04172
04173 #ifdef DEBUG
04174 if (ipixel == trace_pixel_ptr) {
04175 trace_opcTL = top_opc;
04176 trace_rclrTL = top_rclr;
04177 trace_gclrTL = top_gclr;
04178 trace_bclrTL = top_bclr;
04179
04180 }
04181 #endif
04182 ;
04183
04184 acc_opc += bot_opc * wgtBL;
04185
04186 acc_rclr += bot_rclr * wgtBL;
04187 acc_gclr += bot_gclr * wgtBL;
04188 acc_bclr += bot_bclr * wgtBL;
04189
04190 #ifdef DEBUG
04191 if (ipixel == trace_pixel_ptr) {
04192 trace_opcBL = bot_opc;
04193 trace_rclrBL = bot_rclr;
04194 trace_gclrBL = bot_gclr;
04195 trace_bclrBL = bot_bclr;
04196
04197 }
04198 #endif
04199 ;
04200
04201
04202 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
04203 opacity = param0_table[opac_param];
04204 if (param1_size != 0) {
04205 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
04206 opacity *= param1_table[opac_param];
04207 if (param2_size != 0) {
04208 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
04209 opacity *= param2_table[opac_param];
04210 }
04211 }
04212 if (opacity > min_opacity) {
04213 opacity_int = opacity*255.;
04214 bot_opc = opac_correct[opacity_int];
04215 } else {
04216 bot_opc = (float)0.;
04217 };
04218
04219
04220 shade_index=2*3*ShortField(botRLEdata,norm_offset);
04221 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
04222
04223
04224
04225 bot_rclr =
04226 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04227
04228 bot_gclr =
04229 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04230
04231 bot_bclr =
04232 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04233 ;
04234 ;
04235 ;
04236
04237
04238 bot_rclr +=
04239 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04240
04241 bot_gclr +=
04242 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04243
04244 bot_bclr +=
04245 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04246 ;
04247 ;
04248 ;
04249 shade_factor = bot_opc * slice_depth_cueing;
04250
04251 bot_rclr *= shade_factor;
04252 bot_gclr *= shade_factor;
04253 bot_bclr *= shade_factor;
04254 ;
04255
04256 acc_opc += bot_opc * wgtBR;
04257
04258 acc_rclr += bot_rclr * wgtBR;
04259 acc_gclr += bot_gclr * wgtBR;
04260 acc_bclr += bot_bclr * wgtBR;
04261
04262 #ifdef DEBUG
04263 if (ipixel == trace_pixel_ptr) {
04264 trace_opcBR = bot_opc;
04265 trace_rclrBR = bot_rclr;
04266 trace_gclrBR = bot_gclr;
04267 trace_bclrBR = bot_bclr;
04268
04269 }
04270 #endif
04271 ;
04272
04273 COUNT_RESAMPLE;
04274 if (acc_opc > min_opacity) {
04275 COUNT_COMPOSITE;
04276 iopc = ipixel->opcflt;
04277 # ifndef SKIP_ERT
04278 ASSERT(iopc < max_opacity);
04279 # endif
04280 iopc_inv = (float)1. - iopc;
04281
04282 ipixel->rclrflt += acc_rclr * iopc_inv;
04283 ipixel->gclrflt += acc_gclr * iopc_inv;
04284 ipixel->bclrflt += acc_bclr * iopc_inv;
04285 iopc += acc_opc * iopc_inv;
04286 ipixel->opcflt = iopc;
04287
04288 #ifdef DEBUG
04289 if (ipixel == trace_pixel_ptr) {
04290 #ifdef COMPUTE_SHADOW_BUFFER
04291 printf("{%3d} %3d %3d", k, icount-i-count, j);
04292 #else
04293 printf("[%3d] %3d %3d", k, icount-i-count, j);
04294 #endif
04295 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04296 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04297 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04298 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04299 printf(" %3.0f %3.0f\n", iopc*255.,
04300 ipixel->rclrflt);
04301
04302
04303 printf(" ");
04304 printf(" %3.0f ",trace_gclrTL);
04305 printf(" %3.0f ",trace_gclrBL);
04306 printf(" %3.0f ",trace_gclrTR);
04307 printf(" %3.0f ",trace_gclrBR);
04308 printf(" %3.0f\n", ipixel->gclrflt);
04309 printf(" ");
04310 printf(" %3.0f ",trace_bclrTL);
04311 printf(" %3.0f ",trace_bclrBL);
04312 printf(" %3.0f ",trace_bclrTR);
04313 printf(" %3.0f ",trace_bclrBR);
04314 printf(" %3.0f\n", ipixel->bclrflt);
04315 }
04316 #endif
04317 ;
04318 # ifndef SKIP_ERT
04319 if (iopc >= max_opacity) {
04320 ASSERT(ipixel->lnk == 0);
04321 ipixel->lnk = 1;
04322 }
04323 # endif
04324 };
04325 ipixel += 1;
04326 topRLEdata += 1 * voxel_istride;
04327 botRLEdata += 1 * voxel_istride;
04328 count--;
04329 SET_VOXELS_LOADED;
04330
04331
04332
04333 while (count > 0) {
04334 if (PIXEL_IS_OPAQUE(ipixel))
04335 break;
04336 if (!voxels_loaded) {
04337
04338
04339 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
04340 opacity = param0_table[opac_param];
04341 if (param1_size != 0) {
04342 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
04343 opacity *= param1_table[opac_param];
04344 if (param2_size != 0) {
04345 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
04346 opacity *= param2_table[opac_param];
04347 }
04348 }
04349 if (opacity > min_opacity) {
04350 opacity_int = opacity*255.;
04351 bot_opc = opac_correct[opacity_int];
04352 } else {
04353 bot_opc = (float)0.;
04354 };
04355
04356
04357 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
04358 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
04359
04360
04361
04362 bot_rclr =
04363 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04364
04365 bot_gclr =
04366 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04367
04368 bot_bclr =
04369 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04370 ;
04371 ;
04372 ;
04373
04374
04375 bot_rclr +=
04376 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04377
04378 bot_gclr +=
04379 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04380
04381 bot_bclr +=
04382 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04383 ;
04384 ;
04385 ;
04386 shade_factor = bot_opc * slice_depth_cueing;
04387
04388 bot_rclr *= shade_factor;
04389 bot_gclr *= shade_factor;
04390 bot_bclr *= shade_factor;
04391 ;
04392 }
04393
04394 #ifdef DEBUG
04395 if (ipixel == trace_pixel_ptr) {
04396 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04397 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04398 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04399 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04400 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04401 }
04402 #endif
04403 ;
04404
04405 acc_opc = bot_opc * wgtBL;
04406
04407 acc_rclr = bot_rclr * wgtBL;
04408 acc_gclr = bot_gclr * wgtBL;
04409 acc_bclr = bot_bclr * wgtBL;
04410
04411 #ifdef DEBUG
04412 if (ipixel == trace_pixel_ptr) {
04413 trace_opcBL = bot_opc;
04414 trace_rclrBL = bot_rclr;
04415 trace_gclrBL = bot_gclr;
04416 trace_bclrBL = bot_bclr;
04417
04418 }
04419 #endif
04420 ;
04421
04422
04423 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
04424 opacity = param0_table[opac_param];
04425 if (param1_size != 0) {
04426 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
04427 opacity *= param1_table[opac_param];
04428 if (param2_size != 0) {
04429 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
04430 opacity *= param2_table[opac_param];
04431 }
04432 }
04433 if (opacity > min_opacity) {
04434 opacity_int = opacity*255.;
04435 bot_opc = opac_correct[opacity_int];
04436 } else {
04437 bot_opc = (float)0.;
04438 };
04439
04440
04441 shade_index=2*3*ShortField(botRLEdata,norm_offset);
04442 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
04443
04444
04445
04446 bot_rclr =
04447 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04448
04449 bot_gclr =
04450 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04451
04452 bot_bclr =
04453 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04454 ;
04455 ;
04456 ;
04457
04458
04459 bot_rclr +=
04460 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04461
04462 bot_gclr +=
04463 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04464
04465 bot_bclr +=
04466 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04467 ;
04468 ;
04469 ;
04470 shade_factor = bot_opc * slice_depth_cueing;
04471
04472 bot_rclr *= shade_factor;
04473 bot_gclr *= shade_factor;
04474 bot_bclr *= shade_factor;
04475 ;
04476
04477 acc_opc += bot_opc * wgtBR;
04478
04479 acc_rclr += bot_rclr * wgtBR;
04480 acc_gclr += bot_gclr * wgtBR;
04481 acc_bclr += bot_bclr * wgtBR;
04482
04483 #ifdef DEBUG
04484 if (ipixel == trace_pixel_ptr) {
04485 trace_opcBR = bot_opc;
04486 trace_rclrBR = bot_rclr;
04487 trace_gclrBR = bot_gclr;
04488 trace_bclrBR = bot_bclr;
04489
04490 }
04491 #endif
04492 ;
04493
04494 COUNT_RESAMPLE;
04495 if (acc_opc > min_opacity) {
04496 COUNT_COMPOSITE;
04497 iopc = ipixel->opcflt;
04498 # ifndef SKIP_ERT
04499 ASSERT(iopc < max_opacity);
04500 # endif
04501 iopc_inv = (float)1. - iopc;
04502
04503 ipixel->rclrflt += acc_rclr * iopc_inv;
04504 ipixel->gclrflt += acc_gclr * iopc_inv;
04505 ipixel->bclrflt += acc_bclr * iopc_inv;
04506 iopc += acc_opc * iopc_inv;
04507 ipixel->opcflt = iopc;
04508
04509 #ifdef DEBUG
04510 if (ipixel == trace_pixel_ptr) {
04511 #ifdef COMPUTE_SHADOW_BUFFER
04512 printf("{%3d} %3d %3d", k, icount-i-count, j);
04513 #else
04514 printf("[%3d] %3d %3d", k, icount-i-count, j);
04515 #endif
04516 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04517 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04518 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04519 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04520 printf(" %3.0f %3.0f\n", iopc*255.,
04521 ipixel->rclrflt);
04522
04523
04524 printf(" ");
04525 printf(" %3.0f ",trace_gclrTL);
04526 printf(" %3.0f ",trace_gclrBL);
04527 printf(" %3.0f ",trace_gclrTR);
04528 printf(" %3.0f ",trace_gclrBR);
04529 printf(" %3.0f\n", ipixel->gclrflt);
04530 printf(" ");
04531 printf(" %3.0f ",trace_bclrTL);
04532 printf(" %3.0f ",trace_bclrBL);
04533 printf(" %3.0f ",trace_bclrTR);
04534 printf(" %3.0f ",trace_bclrBR);
04535 printf(" %3.0f\n", ipixel->bclrflt);
04536 }
04537 #endif
04538 ;
04539 # ifndef SKIP_ERT
04540 if (iopc >= max_opacity) {
04541 ASSERT(ipixel->lnk == 0);
04542 ipixel->lnk = 1;
04543 }
04544 # endif
04545 };
04546 ipixel += 1;
04547 topRLEdata += 1 * voxel_istride;
04548 botRLEdata += 1 * voxel_istride;
04549 count--;
04550 SET_VOXELS_LOADED;
04551 }
04552 break;
04553 case ALL_ZERO__ALL_NONZERO:
04554
04555
04556
04557 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
04558 opacity = param0_table[opac_param];
04559 if (param1_size != 0) {
04560 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
04561 opacity *= param1_table[opac_param];
04562 if (param2_size != 0) {
04563 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
04564 opacity *= param2_table[opac_param];
04565 }
04566 }
04567 if (opacity > min_opacity) {
04568 opacity_int = opacity*255.;
04569 top_opc = opac_correct[opacity_int];
04570 } else {
04571 top_opc = (float)0.;
04572 };
04573
04574
04575 shade_index=2*3*ShortField(topRLEdata,norm_offset);
04576 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
04577
04578
04579
04580 top_rclr =
04581 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04582
04583 top_gclr =
04584 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04585
04586 top_bclr =
04587 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04588 ;
04589 ;
04590 ;
04591
04592
04593 top_rclr +=
04594 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04595
04596 top_gclr +=
04597 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04598
04599 top_bclr +=
04600 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04601 ;
04602 ;
04603 ;
04604 shade_factor = top_opc * slice_depth_cueing;
04605
04606 top_rclr *= shade_factor;
04607 top_gclr *= shade_factor;
04608 top_bclr *= shade_factor;
04609 ;
04610
04611
04612 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
04613 opacity = param0_table[opac_param];
04614 if (param1_size != 0) {
04615 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
04616 opacity *= param1_table[opac_param];
04617 if (param2_size != 0) {
04618 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
04619 opacity *= param2_table[opac_param];
04620 }
04621 }
04622 if (opacity > min_opacity) {
04623 opacity_int = opacity*255.;
04624 bot_opc = opac_correct[opacity_int];
04625 } else {
04626 bot_opc = (float)0.;
04627 };
04628
04629
04630 shade_index=2*3*ShortField(botRLEdata,norm_offset);
04631 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
04632
04633
04634
04635 bot_rclr =
04636 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04637
04638 bot_gclr =
04639 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04640
04641 bot_bclr =
04642 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04643 ;
04644 ;
04645 ;
04646
04647
04648 bot_rclr +=
04649 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04650
04651 bot_gclr +=
04652 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04653
04654 bot_bclr +=
04655 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04656 ;
04657 ;
04658 ;
04659 shade_factor = bot_opc * slice_depth_cueing;
04660
04661 bot_rclr *= shade_factor;
04662 bot_gclr *= shade_factor;
04663 bot_bclr *= shade_factor;
04664 ;
04665
04666 #ifdef DEBUG
04667 if (ipixel == trace_pixel_ptr) {
04668 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04669 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04670 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04671 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04672 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04673 }
04674 #endif
04675 ;
04676
04677 acc_opc = top_opc * wgtTR;
04678
04679 acc_rclr = top_rclr * wgtTR;
04680 acc_gclr = top_gclr * wgtTR;
04681 acc_bclr = top_bclr * wgtTR;
04682
04683 #ifdef DEBUG
04684 if (ipixel == trace_pixel_ptr) {
04685 trace_opcTR = top_opc;
04686 trace_rclrTR = top_rclr;
04687 trace_gclrTR = top_gclr;
04688 trace_bclrTR = top_bclr;
04689
04690 }
04691 #endif
04692 ;
04693
04694 acc_opc += bot_opc * wgtBR;
04695
04696 acc_rclr += bot_rclr * wgtBR;
04697 acc_gclr += bot_gclr * wgtBR;
04698 acc_bclr += bot_bclr * wgtBR;
04699
04700 #ifdef DEBUG
04701 if (ipixel == trace_pixel_ptr) {
04702 trace_opcBR = bot_opc;
04703 trace_rclrBR = bot_rclr;
04704 trace_gclrBR = bot_gclr;
04705 trace_bclrBR = bot_bclr;
04706
04707 }
04708 #endif
04709 ;
04710
04711 COUNT_RESAMPLE;
04712 if (acc_opc > min_opacity) {
04713 COUNT_COMPOSITE;
04714 iopc = ipixel->opcflt;
04715 # ifndef SKIP_ERT
04716 ASSERT(iopc < max_opacity);
04717 # endif
04718 iopc_inv = (float)1. - iopc;
04719
04720 ipixel->rclrflt += acc_rclr * iopc_inv;
04721 ipixel->gclrflt += acc_gclr * iopc_inv;
04722 ipixel->bclrflt += acc_bclr * iopc_inv;
04723 iopc += acc_opc * iopc_inv;
04724 ipixel->opcflt = iopc;
04725
04726 #ifdef DEBUG
04727 if (ipixel == trace_pixel_ptr) {
04728 #ifdef COMPUTE_SHADOW_BUFFER
04729 printf("{%3d} %3d %3d", k, icount-i-count, j);
04730 #else
04731 printf("[%3d] %3d %3d", k, icount-i-count, j);
04732 #endif
04733 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
04734 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
04735 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
04736 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
04737 printf(" %3.0f %3.0f\n", iopc*255.,
04738 ipixel->rclrflt);
04739
04740
04741 printf(" ");
04742 printf(" %3.0f ",trace_gclrTL);
04743 printf(" %3.0f ",trace_gclrBL);
04744 printf(" %3.0f ",trace_gclrTR);
04745 printf(" %3.0f ",trace_gclrBR);
04746 printf(" %3.0f\n", ipixel->gclrflt);
04747 printf(" ");
04748 printf(" %3.0f ",trace_bclrTL);
04749 printf(" %3.0f ",trace_bclrBL);
04750 printf(" %3.0f ",trace_bclrTR);
04751 printf(" %3.0f ",trace_bclrBR);
04752 printf(" %3.0f\n", ipixel->bclrflt);
04753 }
04754 #endif
04755 ;
04756 # ifndef SKIP_ERT
04757 if (iopc >= max_opacity) {
04758 ASSERT(ipixel->lnk == 0);
04759 ipixel->lnk = 1;
04760 }
04761 # endif
04762 };
04763 ipixel += 1;
04764 topRLEdata += 1 * voxel_istride;
04765 botRLEdata += 1 * voxel_istride;
04766 count--;
04767 SET_VOXELS_LOADED;
04768
04769
04770
04771 while (count > 0) {
04772 if (PIXEL_IS_OPAQUE(ipixel))
04773 break;
04774 if (!voxels_loaded) {
04775
04776
04777 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
04778 opacity = param0_table[opac_param];
04779 if (param1_size != 0) {
04780 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
04781 opacity *= param1_table[opac_param];
04782 if (param2_size != 0) {
04783 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
04784 opacity *= param2_table[opac_param];
04785 }
04786 }
04787 if (opacity > min_opacity) {
04788 opacity_int = opacity*255.;
04789 top_opc = opac_correct[opacity_int];
04790 } else {
04791 top_opc = (float)0.;
04792 };
04793
04794
04795 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
04796 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
04797
04798
04799
04800 top_rclr =
04801 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04802
04803 top_gclr =
04804 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04805
04806 top_bclr =
04807 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04808 ;
04809 ;
04810 ;
04811
04812
04813 top_rclr +=
04814 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04815
04816 top_gclr +=
04817 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04818
04819 top_bclr +=
04820 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04821 ;
04822 ;
04823 ;
04824 shade_factor = top_opc * slice_depth_cueing;
04825
04826 top_rclr *= shade_factor;
04827 top_gclr *= shade_factor;
04828 top_bclr *= shade_factor;
04829 ;
04830
04831
04832 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
04833 opacity = param0_table[opac_param];
04834 if (param1_size != 0) {
04835 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
04836 opacity *= param1_table[opac_param];
04837 if (param2_size != 0) {
04838 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
04839 opacity *= param2_table[opac_param];
04840 }
04841 }
04842 if (opacity > min_opacity) {
04843 opacity_int = opacity*255.;
04844 bot_opc = opac_correct[opacity_int];
04845 } else {
04846 bot_opc = (float)0.;
04847 };
04848
04849
04850 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
04851 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
04852
04853
04854
04855 bot_rclr =
04856 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04857
04858 bot_gclr =
04859 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04860
04861 bot_bclr =
04862 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04863 ;
04864 ;
04865 ;
04866
04867
04868 bot_rclr +=
04869 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04870
04871 bot_gclr +=
04872 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04873
04874 bot_bclr +=
04875 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04876 ;
04877 ;
04878 ;
04879 shade_factor = bot_opc * slice_depth_cueing;
04880
04881 bot_rclr *= shade_factor;
04882 bot_gclr *= shade_factor;
04883 bot_bclr *= shade_factor;
04884 ;
04885 }
04886
04887 #ifdef DEBUG
04888 if (ipixel == trace_pixel_ptr) {
04889 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
04890 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
04891 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
04892 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
04893 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
04894 }
04895 #endif
04896 ;
04897
04898 acc_opc = top_opc * wgtTL;
04899
04900 acc_rclr = top_rclr * wgtTL;
04901 acc_gclr = top_gclr * wgtTL;
04902 acc_bclr = top_bclr * wgtTL;
04903
04904 #ifdef DEBUG
04905 if (ipixel == trace_pixel_ptr) {
04906 trace_opcTL = top_opc;
04907 trace_rclrTL = top_rclr;
04908 trace_gclrTL = top_gclr;
04909 trace_bclrTL = top_bclr;
04910
04911 }
04912 #endif
04913 ;
04914
04915 acc_opc += bot_opc * wgtBL;
04916
04917 acc_rclr += bot_rclr * wgtBL;
04918 acc_gclr += bot_gclr * wgtBL;
04919 acc_bclr += bot_bclr * wgtBL;
04920
04921 #ifdef DEBUG
04922 if (ipixel == trace_pixel_ptr) {
04923 trace_opcBL = bot_opc;
04924 trace_rclrBL = bot_rclr;
04925 trace_gclrBL = bot_gclr;
04926 trace_bclrBL = bot_bclr;
04927
04928 }
04929 #endif
04930 ;
04931
04932
04933 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
04934 opacity = param0_table[opac_param];
04935 if (param1_size != 0) {
04936 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
04937 opacity *= param1_table[opac_param];
04938 if (param2_size != 0) {
04939 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
04940 opacity *= param2_table[opac_param];
04941 }
04942 }
04943 if (opacity > min_opacity) {
04944 opacity_int = opacity*255.;
04945 top_opc = opac_correct[opacity_int];
04946 } else {
04947 top_opc = (float)0.;
04948 };
04949
04950
04951 shade_index=2*3*ShortField(topRLEdata,norm_offset);
04952 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
04953
04954
04955
04956 top_rclr =
04957 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
04958
04959 top_gclr =
04960 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
04961
04962 top_bclr =
04963 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
04964 ;
04965 ;
04966 ;
04967
04968
04969 top_rclr +=
04970 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
04971
04972 top_gclr +=
04973 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
04974
04975 top_bclr +=
04976 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
04977 ;
04978 ;
04979 ;
04980 shade_factor = top_opc * slice_depth_cueing;
04981
04982 top_rclr *= shade_factor;
04983 top_gclr *= shade_factor;
04984 top_bclr *= shade_factor;
04985 ;
04986
04987
04988 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
04989 opacity = param0_table[opac_param];
04990 if (param1_size != 0) {
04991 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
04992 opacity *= param1_table[opac_param];
04993 if (param2_size != 0) {
04994 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
04995 opacity *= param2_table[opac_param];
04996 }
04997 }
04998 if (opacity > min_opacity) {
04999 opacity_int = opacity*255.;
05000 bot_opc = opac_correct[opacity_int];
05001 } else {
05002 bot_opc = (float)0.;
05003 };
05004
05005
05006 shade_index=2*3*ShortField(botRLEdata,norm_offset);
05007 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
05008
05009
05010
05011 bot_rclr =
05012 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05013
05014 bot_gclr =
05015 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05016
05017 bot_bclr =
05018 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05019 ;
05020 ;
05021 ;
05022
05023
05024 bot_rclr +=
05025 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05026
05027 bot_gclr +=
05028 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05029
05030 bot_bclr +=
05031 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05032 ;
05033 ;
05034 ;
05035 shade_factor = bot_opc * slice_depth_cueing;
05036
05037 bot_rclr *= shade_factor;
05038 bot_gclr *= shade_factor;
05039 bot_bclr *= shade_factor;
05040 ;
05041
05042 acc_opc += top_opc * wgtTR;
05043
05044 acc_rclr += top_rclr * wgtTR;
05045 acc_gclr += top_gclr * wgtTR;
05046 acc_bclr += top_bclr * wgtTR;
05047
05048 #ifdef DEBUG
05049 if (ipixel == trace_pixel_ptr) {
05050 trace_opcTR = top_opc;
05051 trace_rclrTR = top_rclr;
05052 trace_gclrTR = top_gclr;
05053 trace_bclrTR = top_bclr;
05054
05055 }
05056 #endif
05057 ;
05058
05059 acc_opc += bot_opc * wgtBR;
05060
05061 acc_rclr += bot_rclr * wgtBR;
05062 acc_gclr += bot_gclr * wgtBR;
05063 acc_bclr += bot_bclr * wgtBR;
05064
05065 #ifdef DEBUG
05066 if (ipixel == trace_pixel_ptr) {
05067 trace_opcBR = bot_opc;
05068 trace_rclrBR = bot_rclr;
05069 trace_gclrBR = bot_gclr;
05070 trace_bclrBR = bot_bclr;
05071
05072 }
05073 #endif
05074 ;
05075
05076 COUNT_RESAMPLE;
05077 if (acc_opc > min_opacity) {
05078 COUNT_COMPOSITE;
05079 iopc = ipixel->opcflt;
05080 # ifndef SKIP_ERT
05081 ASSERT(iopc < max_opacity);
05082 # endif
05083 iopc_inv = (float)1. - iopc;
05084
05085 ipixel->rclrflt += acc_rclr * iopc_inv;
05086 ipixel->gclrflt += acc_gclr * iopc_inv;
05087 ipixel->bclrflt += acc_bclr * iopc_inv;
05088 iopc += acc_opc * iopc_inv;
05089 ipixel->opcflt = iopc;
05090
05091 #ifdef DEBUG
05092 if (ipixel == trace_pixel_ptr) {
05093 #ifdef COMPUTE_SHADOW_BUFFER
05094 printf("{%3d} %3d %3d", k, icount-i-count, j);
05095 #else
05096 printf("[%3d] %3d %3d", k, icount-i-count, j);
05097 #endif
05098 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05099 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05100 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05101 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05102 printf(" %3.0f %3.0f\n", iopc*255.,
05103 ipixel->rclrflt);
05104
05105
05106 printf(" ");
05107 printf(" %3.0f ",trace_gclrTL);
05108 printf(" %3.0f ",trace_gclrBL);
05109 printf(" %3.0f ",trace_gclrTR);
05110 printf(" %3.0f ",trace_gclrBR);
05111 printf(" %3.0f\n", ipixel->gclrflt);
05112 printf(" ");
05113 printf(" %3.0f ",trace_bclrTL);
05114 printf(" %3.0f ",trace_bclrBL);
05115 printf(" %3.0f ",trace_bclrTR);
05116 printf(" %3.0f ",trace_bclrBR);
05117 printf(" %3.0f\n", ipixel->bclrflt);
05118 }
05119 #endif
05120 ;
05121 # ifndef SKIP_ERT
05122 if (iopc >= max_opacity) {
05123 ASSERT(ipixel->lnk == 0);
05124 ipixel->lnk = 1;
05125 }
05126 # endif
05127 };
05128 ipixel += 1;
05129 topRLEdata += 1 * voxel_istride;
05130 botRLEdata += 1 * voxel_istride;
05131 count--;
05132 SET_VOXELS_LOADED;
05133 }
05134 break;
05135 case TOP_NONZERO__ALL_NONZERO:
05136
05137
05138 if (!voxels_loaded) {
05139
05140
05141 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
05142 opacity = param0_table[opac_param];
05143 if (param1_size != 0) {
05144 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
05145 opacity *= param1_table[opac_param];
05146 if (param2_size != 0) {
05147 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
05148 opacity *= param2_table[opac_param];
05149 }
05150 }
05151 if (opacity > min_opacity) {
05152 opacity_int = opacity*255.;
05153 top_opc = opac_correct[opacity_int];
05154 } else {
05155 top_opc = (float)0.;
05156 };
05157
05158
05159 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
05160 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
05161
05162
05163
05164 top_rclr =
05165 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05166
05167 top_gclr =
05168 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05169
05170 top_bclr =
05171 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05172 ;
05173 ;
05174 ;
05175
05176
05177 top_rclr +=
05178 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05179
05180 top_gclr +=
05181 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05182
05183 top_bclr +=
05184 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05185 ;
05186 ;
05187 ;
05188 shade_factor = top_opc * slice_depth_cueing;
05189
05190 top_rclr *= shade_factor;
05191 top_gclr *= shade_factor;
05192 top_bclr *= shade_factor;
05193 ;
05194 }
05195
05196 #ifdef DEBUG
05197 if (ipixel == trace_pixel_ptr) {
05198 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05199 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05200 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05201 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05202 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05203 }
05204 #endif
05205 ;
05206
05207 acc_opc = top_opc * wgtTL;
05208
05209 acc_rclr = top_rclr * wgtTL;
05210 acc_gclr = top_gclr * wgtTL;
05211 acc_bclr = top_bclr * wgtTL;
05212
05213 #ifdef DEBUG
05214 if (ipixel == trace_pixel_ptr) {
05215 trace_opcTL = top_opc;
05216 trace_rclrTL = top_rclr;
05217 trace_gclrTL = top_gclr;
05218 trace_bclrTL = top_bclr;
05219
05220 }
05221 #endif
05222 ;
05223
05224
05225 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
05226 opacity = param0_table[opac_param];
05227 if (param1_size != 0) {
05228 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
05229 opacity *= param1_table[opac_param];
05230 if (param2_size != 0) {
05231 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
05232 opacity *= param2_table[opac_param];
05233 }
05234 }
05235 if (opacity > min_opacity) {
05236 opacity_int = opacity*255.;
05237 top_opc = opac_correct[opacity_int];
05238 } else {
05239 top_opc = (float)0.;
05240 };
05241
05242
05243 shade_index=2*3*ShortField(topRLEdata,norm_offset);
05244 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
05245
05246
05247
05248 top_rclr =
05249 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05250
05251 top_gclr =
05252 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05253
05254 top_bclr =
05255 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05256 ;
05257 ;
05258 ;
05259
05260
05261 top_rclr +=
05262 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05263
05264 top_gclr +=
05265 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05266
05267 top_bclr +=
05268 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05269 ;
05270 ;
05271 ;
05272 shade_factor = top_opc * slice_depth_cueing;
05273
05274 top_rclr *= shade_factor;
05275 top_gclr *= shade_factor;
05276 top_bclr *= shade_factor;
05277 ;
05278
05279
05280 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
05281 opacity = param0_table[opac_param];
05282 if (param1_size != 0) {
05283 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
05284 opacity *= param1_table[opac_param];
05285 if (param2_size != 0) {
05286 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
05287 opacity *= param2_table[opac_param];
05288 }
05289 }
05290 if (opacity > min_opacity) {
05291 opacity_int = opacity*255.;
05292 bot_opc = opac_correct[opacity_int];
05293 } else {
05294 bot_opc = (float)0.;
05295 };
05296
05297
05298 shade_index=2*3*ShortField(botRLEdata,norm_offset);
05299 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
05300
05301
05302
05303 bot_rclr =
05304 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05305
05306 bot_gclr =
05307 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05308
05309 bot_bclr =
05310 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05311 ;
05312 ;
05313 ;
05314
05315
05316 bot_rclr +=
05317 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05318
05319 bot_gclr +=
05320 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05321
05322 bot_bclr +=
05323 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05324 ;
05325 ;
05326 ;
05327 shade_factor = bot_opc * slice_depth_cueing;
05328
05329 bot_rclr *= shade_factor;
05330 bot_gclr *= shade_factor;
05331 bot_bclr *= shade_factor;
05332 ;
05333
05334 acc_opc += top_opc * wgtTR;
05335
05336 acc_rclr += top_rclr * wgtTR;
05337 acc_gclr += top_gclr * wgtTR;
05338 acc_bclr += top_bclr * wgtTR;
05339
05340 #ifdef DEBUG
05341 if (ipixel == trace_pixel_ptr) {
05342 trace_opcTR = top_opc;
05343 trace_rclrTR = top_rclr;
05344 trace_gclrTR = top_gclr;
05345 trace_bclrTR = top_bclr;
05346
05347 }
05348 #endif
05349 ;
05350
05351 acc_opc += bot_opc * wgtBR;
05352
05353 acc_rclr += bot_rclr * wgtBR;
05354 acc_gclr += bot_gclr * wgtBR;
05355 acc_bclr += bot_bclr * wgtBR;
05356
05357 #ifdef DEBUG
05358 if (ipixel == trace_pixel_ptr) {
05359 trace_opcBR = bot_opc;
05360 trace_rclrBR = bot_rclr;
05361 trace_gclrBR = bot_gclr;
05362 trace_bclrBR = bot_bclr;
05363
05364 }
05365 #endif
05366 ;
05367
05368 COUNT_RESAMPLE;
05369 if (acc_opc > min_opacity) {
05370 COUNT_COMPOSITE;
05371 iopc = ipixel->opcflt;
05372 # ifndef SKIP_ERT
05373 ASSERT(iopc < max_opacity);
05374 # endif
05375 iopc_inv = (float)1. - iopc;
05376
05377 ipixel->rclrflt += acc_rclr * iopc_inv;
05378 ipixel->gclrflt += acc_gclr * iopc_inv;
05379 ipixel->bclrflt += acc_bclr * iopc_inv;
05380 iopc += acc_opc * iopc_inv;
05381 ipixel->opcflt = iopc;
05382
05383 #ifdef DEBUG
05384 if (ipixel == trace_pixel_ptr) {
05385 #ifdef COMPUTE_SHADOW_BUFFER
05386 printf("{%3d} %3d %3d", k, icount-i-count, j);
05387 #else
05388 printf("[%3d] %3d %3d", k, icount-i-count, j);
05389 #endif
05390 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05391 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05392 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05393 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05394 printf(" %3.0f %3.0f\n", iopc*255.,
05395 ipixel->rclrflt);
05396
05397
05398 printf(" ");
05399 printf(" %3.0f ",trace_gclrTL);
05400 printf(" %3.0f ",trace_gclrBL);
05401 printf(" %3.0f ",trace_gclrTR);
05402 printf(" %3.0f ",trace_gclrBR);
05403 printf(" %3.0f\n", ipixel->gclrflt);
05404 printf(" ");
05405 printf(" %3.0f ",trace_bclrTL);
05406 printf(" %3.0f ",trace_bclrBL);
05407 printf(" %3.0f ",trace_bclrTR);
05408 printf(" %3.0f ",trace_bclrBR);
05409 printf(" %3.0f\n", ipixel->bclrflt);
05410 }
05411 #endif
05412 ;
05413 # ifndef SKIP_ERT
05414 if (iopc >= max_opacity) {
05415 ASSERT(ipixel->lnk == 0);
05416 ipixel->lnk = 1;
05417 }
05418 # endif
05419 };
05420 ipixel += 1;
05421 topRLEdata += 1 * voxel_istride;
05422 botRLEdata += 1 * voxel_istride;
05423 count--;
05424 SET_VOXELS_LOADED;
05425
05426
05427
05428 while (count > 0) {
05429 if (PIXEL_IS_OPAQUE(ipixel))
05430 break;
05431 if (!voxels_loaded) {
05432
05433
05434 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
05435 opacity = param0_table[opac_param];
05436 if (param1_size != 0) {
05437 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
05438 opacity *= param1_table[opac_param];
05439 if (param2_size != 0) {
05440 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
05441 opacity *= param2_table[opac_param];
05442 }
05443 }
05444 if (opacity > min_opacity) {
05445 opacity_int = opacity*255.;
05446 top_opc = opac_correct[opacity_int];
05447 } else {
05448 top_opc = (float)0.;
05449 };
05450
05451
05452 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
05453 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
05454
05455
05456
05457 top_rclr =
05458 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05459
05460 top_gclr =
05461 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05462
05463 top_bclr =
05464 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05465 ;
05466 ;
05467 ;
05468
05469
05470 top_rclr +=
05471 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05472
05473 top_gclr +=
05474 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05475
05476 top_bclr +=
05477 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05478 ;
05479 ;
05480 ;
05481 shade_factor = top_opc * slice_depth_cueing;
05482
05483 top_rclr *= shade_factor;
05484 top_gclr *= shade_factor;
05485 top_bclr *= shade_factor;
05486 ;
05487
05488
05489 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
05490 opacity = param0_table[opac_param];
05491 if (param1_size != 0) {
05492 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
05493 opacity *= param1_table[opac_param];
05494 if (param2_size != 0) {
05495 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
05496 opacity *= param2_table[opac_param];
05497 }
05498 }
05499 if (opacity > min_opacity) {
05500 opacity_int = opacity*255.;
05501 bot_opc = opac_correct[opacity_int];
05502 } else {
05503 bot_opc = (float)0.;
05504 };
05505
05506
05507 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
05508 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
05509
05510
05511
05512 bot_rclr =
05513 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05514
05515 bot_gclr =
05516 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05517
05518 bot_bclr =
05519 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05520 ;
05521 ;
05522 ;
05523
05524
05525 bot_rclr +=
05526 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05527
05528 bot_gclr +=
05529 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05530
05531 bot_bclr +=
05532 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05533 ;
05534 ;
05535 ;
05536 shade_factor = bot_opc * slice_depth_cueing;
05537
05538 bot_rclr *= shade_factor;
05539 bot_gclr *= shade_factor;
05540 bot_bclr *= shade_factor;
05541 ;
05542 }
05543
05544 #ifdef DEBUG
05545 if (ipixel == trace_pixel_ptr) {
05546 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05547 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05548 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05549 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05550 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05551 }
05552 #endif
05553 ;
05554
05555 acc_opc = top_opc * wgtTL;
05556
05557 acc_rclr = top_rclr * wgtTL;
05558 acc_gclr = top_gclr * wgtTL;
05559 acc_bclr = top_bclr * wgtTL;
05560
05561 #ifdef DEBUG
05562 if (ipixel == trace_pixel_ptr) {
05563 trace_opcTL = top_opc;
05564 trace_rclrTL = top_rclr;
05565 trace_gclrTL = top_gclr;
05566 trace_bclrTL = top_bclr;
05567
05568 }
05569 #endif
05570 ;
05571
05572 acc_opc += bot_opc * wgtBL;
05573
05574 acc_rclr += bot_rclr * wgtBL;
05575 acc_gclr += bot_gclr * wgtBL;
05576 acc_bclr += bot_bclr * wgtBL;
05577
05578 #ifdef DEBUG
05579 if (ipixel == trace_pixel_ptr) {
05580 trace_opcBL = bot_opc;
05581 trace_rclrBL = bot_rclr;
05582 trace_gclrBL = bot_gclr;
05583 trace_bclrBL = bot_bclr;
05584
05585 }
05586 #endif
05587 ;
05588
05589
05590 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
05591 opacity = param0_table[opac_param];
05592 if (param1_size != 0) {
05593 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
05594 opacity *= param1_table[opac_param];
05595 if (param2_size != 0) {
05596 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
05597 opacity *= param2_table[opac_param];
05598 }
05599 }
05600 if (opacity > min_opacity) {
05601 opacity_int = opacity*255.;
05602 top_opc = opac_correct[opacity_int];
05603 } else {
05604 top_opc = (float)0.;
05605 };
05606
05607
05608 shade_index=2*3*ShortField(topRLEdata,norm_offset);
05609 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
05610
05611
05612
05613 top_rclr =
05614 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05615
05616 top_gclr =
05617 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05618
05619 top_bclr =
05620 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05621 ;
05622 ;
05623 ;
05624
05625
05626 top_rclr +=
05627 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05628
05629 top_gclr +=
05630 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05631
05632 top_bclr +=
05633 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05634 ;
05635 ;
05636 ;
05637 shade_factor = top_opc * slice_depth_cueing;
05638
05639 top_rclr *= shade_factor;
05640 top_gclr *= shade_factor;
05641 top_bclr *= shade_factor;
05642 ;
05643
05644
05645 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
05646 opacity = param0_table[opac_param];
05647 if (param1_size != 0) {
05648 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
05649 opacity *= param1_table[opac_param];
05650 if (param2_size != 0) {
05651 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
05652 opacity *= param2_table[opac_param];
05653 }
05654 }
05655 if (opacity > min_opacity) {
05656 opacity_int = opacity*255.;
05657 bot_opc = opac_correct[opacity_int];
05658 } else {
05659 bot_opc = (float)0.;
05660 };
05661
05662
05663 shade_index=2*3*ShortField(botRLEdata,norm_offset);
05664 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
05665
05666
05667
05668 bot_rclr =
05669 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05670
05671 bot_gclr =
05672 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05673
05674 bot_bclr =
05675 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05676 ;
05677 ;
05678 ;
05679
05680
05681 bot_rclr +=
05682 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05683
05684 bot_gclr +=
05685 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05686
05687 bot_bclr +=
05688 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05689 ;
05690 ;
05691 ;
05692 shade_factor = bot_opc * slice_depth_cueing;
05693
05694 bot_rclr *= shade_factor;
05695 bot_gclr *= shade_factor;
05696 bot_bclr *= shade_factor;
05697 ;
05698
05699 acc_opc += top_opc * wgtTR;
05700
05701 acc_rclr += top_rclr * wgtTR;
05702 acc_gclr += top_gclr * wgtTR;
05703 acc_bclr += top_bclr * wgtTR;
05704
05705 #ifdef DEBUG
05706 if (ipixel == trace_pixel_ptr) {
05707 trace_opcTR = top_opc;
05708 trace_rclrTR = top_rclr;
05709 trace_gclrTR = top_gclr;
05710 trace_bclrTR = top_bclr;
05711
05712 }
05713 #endif
05714 ;
05715
05716 acc_opc += bot_opc * wgtBR;
05717
05718 acc_rclr += bot_rclr * wgtBR;
05719 acc_gclr += bot_gclr * wgtBR;
05720 acc_bclr += bot_bclr * wgtBR;
05721
05722 #ifdef DEBUG
05723 if (ipixel == trace_pixel_ptr) {
05724 trace_opcBR = bot_opc;
05725 trace_rclrBR = bot_rclr;
05726 trace_gclrBR = bot_gclr;
05727 trace_bclrBR = bot_bclr;
05728
05729 }
05730 #endif
05731 ;
05732
05733 COUNT_RESAMPLE;
05734 if (acc_opc > min_opacity) {
05735 COUNT_COMPOSITE;
05736 iopc = ipixel->opcflt;
05737 # ifndef SKIP_ERT
05738 ASSERT(iopc < max_opacity);
05739 # endif
05740 iopc_inv = (float)1. - iopc;
05741
05742 ipixel->rclrflt += acc_rclr * iopc_inv;
05743 ipixel->gclrflt += acc_gclr * iopc_inv;
05744 ipixel->bclrflt += acc_bclr * iopc_inv;
05745 iopc += acc_opc * iopc_inv;
05746 ipixel->opcflt = iopc;
05747
05748 #ifdef DEBUG
05749 if (ipixel == trace_pixel_ptr) {
05750 #ifdef COMPUTE_SHADOW_BUFFER
05751 printf("{%3d} %3d %3d", k, icount-i-count, j);
05752 #else
05753 printf("[%3d] %3d %3d", k, icount-i-count, j);
05754 #endif
05755 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
05756 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
05757 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
05758 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
05759 printf(" %3.0f %3.0f\n", iopc*255.,
05760 ipixel->rclrflt);
05761
05762
05763 printf(" ");
05764 printf(" %3.0f ",trace_gclrTL);
05765 printf(" %3.0f ",trace_gclrBL);
05766 printf(" %3.0f ",trace_gclrTR);
05767 printf(" %3.0f ",trace_gclrBR);
05768 printf(" %3.0f\n", ipixel->gclrflt);
05769 printf(" ");
05770 printf(" %3.0f ",trace_bclrTL);
05771 printf(" %3.0f ",trace_bclrBL);
05772 printf(" %3.0f ",trace_bclrTR);
05773 printf(" %3.0f ",trace_bclrBR);
05774 printf(" %3.0f\n", ipixel->bclrflt);
05775 }
05776 #endif
05777 ;
05778 # ifndef SKIP_ERT
05779 if (iopc >= max_opacity) {
05780 ASSERT(ipixel->lnk == 0);
05781 ipixel->lnk = 1;
05782 }
05783 # endif
05784 };
05785 ipixel += 1;
05786 topRLEdata += 1 * voxel_istride;
05787 botRLEdata += 1 * voxel_istride;
05788 count--;
05789 SET_VOXELS_LOADED;
05790 }
05791 break;
05792 case BOT_NONZERO__ALL_NONZERO:
05793
05794
05795 if (!voxels_loaded) {
05796
05797
05798 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
05799 opacity = param0_table[opac_param];
05800 if (param1_size != 0) {
05801 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
05802 opacity *= param1_table[opac_param];
05803 if (param2_size != 0) {
05804 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
05805 opacity *= param2_table[opac_param];
05806 }
05807 }
05808 if (opacity > min_opacity) {
05809 opacity_int = opacity*255.;
05810 bot_opc = opac_correct[opacity_int];
05811 } else {
05812 bot_opc = (float)0.;
05813 };
05814
05815
05816 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
05817 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
05818
05819
05820
05821 bot_rclr =
05822 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05823
05824 bot_gclr =
05825 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05826
05827 bot_bclr =
05828 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05829 ;
05830 ;
05831 ;
05832
05833
05834 bot_rclr +=
05835 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05836
05837 bot_gclr +=
05838 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05839
05840 bot_bclr +=
05841 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05842 ;
05843 ;
05844 ;
05845 shade_factor = bot_opc * slice_depth_cueing;
05846
05847 bot_rclr *= shade_factor;
05848 bot_gclr *= shade_factor;
05849 bot_bclr *= shade_factor;
05850 ;
05851 }
05852
05853 #ifdef DEBUG
05854 if (ipixel == trace_pixel_ptr) {
05855 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
05856 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
05857 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
05858 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
05859 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
05860 }
05861 #endif
05862 ;
05863
05864 acc_opc = bot_opc * wgtBL;
05865
05866 acc_rclr = bot_rclr * wgtBL;
05867 acc_gclr = bot_gclr * wgtBL;
05868 acc_bclr = bot_bclr * wgtBL;
05869
05870 #ifdef DEBUG
05871 if (ipixel == trace_pixel_ptr) {
05872 trace_opcBL = bot_opc;
05873 trace_rclrBL = bot_rclr;
05874 trace_gclrBL = bot_gclr;
05875 trace_bclrBL = bot_bclr;
05876
05877 }
05878 #endif
05879 ;
05880
05881
05882 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
05883 opacity = param0_table[opac_param];
05884 if (param1_size != 0) {
05885 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
05886 opacity *= param1_table[opac_param];
05887 if (param2_size != 0) {
05888 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
05889 opacity *= param2_table[opac_param];
05890 }
05891 }
05892 if (opacity > min_opacity) {
05893 opacity_int = opacity*255.;
05894 top_opc = opac_correct[opacity_int];
05895 } else {
05896 top_opc = (float)0.;
05897 };
05898
05899
05900 shade_index=2*3*ShortField(topRLEdata,norm_offset);
05901 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
05902
05903
05904
05905 top_rclr =
05906 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05907
05908 top_gclr =
05909 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05910
05911 top_bclr =
05912 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05913 ;
05914 ;
05915 ;
05916
05917
05918 top_rclr +=
05919 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05920
05921 top_gclr +=
05922 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05923
05924 top_bclr +=
05925 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05926 ;
05927 ;
05928 ;
05929 shade_factor = top_opc * slice_depth_cueing;
05930
05931 top_rclr *= shade_factor;
05932 top_gclr *= shade_factor;
05933 top_bclr *= shade_factor;
05934 ;
05935
05936
05937 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
05938 opacity = param0_table[opac_param];
05939 if (param1_size != 0) {
05940 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
05941 opacity *= param1_table[opac_param];
05942 if (param2_size != 0) {
05943 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
05944 opacity *= param2_table[opac_param];
05945 }
05946 }
05947 if (opacity > min_opacity) {
05948 opacity_int = opacity*255.;
05949 bot_opc = opac_correct[opacity_int];
05950 } else {
05951 bot_opc = (float)0.;
05952 };
05953
05954
05955 shade_index=2*3*ShortField(botRLEdata,norm_offset);
05956 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
05957
05958
05959
05960 bot_rclr =
05961 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
05962
05963 bot_gclr =
05964 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
05965
05966 bot_bclr =
05967 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
05968 ;
05969 ;
05970 ;
05971
05972
05973 bot_rclr +=
05974 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
05975
05976 bot_gclr +=
05977 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
05978
05979 bot_bclr +=
05980 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
05981 ;
05982 ;
05983 ;
05984 shade_factor = bot_opc * slice_depth_cueing;
05985
05986 bot_rclr *= shade_factor;
05987 bot_gclr *= shade_factor;
05988 bot_bclr *= shade_factor;
05989 ;
05990
05991 acc_opc += top_opc * wgtTR;
05992
05993 acc_rclr += top_rclr * wgtTR;
05994 acc_gclr += top_gclr * wgtTR;
05995 acc_bclr += top_bclr * wgtTR;
05996
05997 #ifdef DEBUG
05998 if (ipixel == trace_pixel_ptr) {
05999 trace_opcTR = top_opc;
06000 trace_rclrTR = top_rclr;
06001 trace_gclrTR = top_gclr;
06002 trace_bclrTR = top_bclr;
06003
06004 }
06005 #endif
06006 ;
06007
06008 acc_opc += bot_opc * wgtBR;
06009
06010 acc_rclr += bot_rclr * wgtBR;
06011 acc_gclr += bot_gclr * wgtBR;
06012 acc_bclr += bot_bclr * wgtBR;
06013
06014 #ifdef DEBUG
06015 if (ipixel == trace_pixel_ptr) {
06016 trace_opcBR = bot_opc;
06017 trace_rclrBR = bot_rclr;
06018 trace_gclrBR = bot_gclr;
06019 trace_bclrBR = bot_bclr;
06020
06021 }
06022 #endif
06023 ;
06024
06025 COUNT_RESAMPLE;
06026 if (acc_opc > min_opacity) {
06027 COUNT_COMPOSITE;
06028 iopc = ipixel->opcflt;
06029 # ifndef SKIP_ERT
06030 ASSERT(iopc < max_opacity);
06031 # endif
06032 iopc_inv = (float)1. - iopc;
06033
06034 ipixel->rclrflt += acc_rclr * iopc_inv;
06035 ipixel->gclrflt += acc_gclr * iopc_inv;
06036 ipixel->bclrflt += acc_bclr * iopc_inv;
06037 iopc += acc_opc * iopc_inv;
06038 ipixel->opcflt = iopc;
06039
06040 #ifdef DEBUG
06041 if (ipixel == trace_pixel_ptr) {
06042 #ifdef COMPUTE_SHADOW_BUFFER
06043 printf("{%3d} %3d %3d", k, icount-i-count, j);
06044 #else
06045 printf("[%3d] %3d %3d", k, icount-i-count, j);
06046 #endif
06047 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
06048 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
06049 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
06050 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
06051 printf(" %3.0f %3.0f\n", iopc*255.,
06052 ipixel->rclrflt);
06053
06054
06055 printf(" ");
06056 printf(" %3.0f ",trace_gclrTL);
06057 printf(" %3.0f ",trace_gclrBL);
06058 printf(" %3.0f ",trace_gclrTR);
06059 printf(" %3.0f ",trace_gclrBR);
06060 printf(" %3.0f\n", ipixel->gclrflt);
06061 printf(" ");
06062 printf(" %3.0f ",trace_bclrTL);
06063 printf(" %3.0f ",trace_bclrBL);
06064 printf(" %3.0f ",trace_bclrTR);
06065 printf(" %3.0f ",trace_bclrBR);
06066 printf(" %3.0f\n", ipixel->bclrflt);
06067 }
06068 #endif
06069 ;
06070 # ifndef SKIP_ERT
06071 if (iopc >= max_opacity) {
06072 ASSERT(ipixel->lnk == 0);
06073 ipixel->lnk = 1;
06074 }
06075 # endif
06076 };
06077 ipixel += 1;
06078 topRLEdata += 1 * voxel_istride;
06079 botRLEdata += 1 * voxel_istride;
06080 count--;
06081 SET_VOXELS_LOADED;
06082
06083
06084
06085 while (count > 0) {
06086 if (PIXEL_IS_OPAQUE(ipixel))
06087 break;
06088 if (!voxels_loaded) {
06089
06090
06091 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
06092 opacity = param0_table[opac_param];
06093 if (param1_size != 0) {
06094 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
06095 opacity *= param1_table[opac_param];
06096 if (param2_size != 0) {
06097 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
06098 opacity *= param2_table[opac_param];
06099 }
06100 }
06101 if (opacity > min_opacity) {
06102 opacity_int = opacity*255.;
06103 top_opc = opac_correct[opacity_int];
06104 } else {
06105 top_opc = (float)0.;
06106 };
06107
06108
06109 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
06110 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
06111
06112
06113
06114 top_rclr =
06115 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06116
06117 top_gclr =
06118 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06119
06120 top_bclr =
06121 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06122 ;
06123 ;
06124 ;
06125
06126
06127 top_rclr +=
06128 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06129
06130 top_gclr +=
06131 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06132
06133 top_bclr +=
06134 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06135 ;
06136 ;
06137 ;
06138 shade_factor = top_opc * slice_depth_cueing;
06139
06140 top_rclr *= shade_factor;
06141 top_gclr *= shade_factor;
06142 top_bclr *= shade_factor;
06143 ;
06144
06145
06146 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
06147 opacity = param0_table[opac_param];
06148 if (param1_size != 0) {
06149 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
06150 opacity *= param1_table[opac_param];
06151 if (param2_size != 0) {
06152 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
06153 opacity *= param2_table[opac_param];
06154 }
06155 }
06156 if (opacity > min_opacity) {
06157 opacity_int = opacity*255.;
06158 bot_opc = opac_correct[opacity_int];
06159 } else {
06160 bot_opc = (float)0.;
06161 };
06162
06163
06164 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
06165 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
06166
06167
06168
06169 bot_rclr =
06170 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06171
06172 bot_gclr =
06173 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06174
06175 bot_bclr =
06176 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06177 ;
06178 ;
06179 ;
06180
06181
06182 bot_rclr +=
06183 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06184
06185 bot_gclr +=
06186 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06187
06188 bot_bclr +=
06189 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06190 ;
06191 ;
06192 ;
06193 shade_factor = bot_opc * slice_depth_cueing;
06194
06195 bot_rclr *= shade_factor;
06196 bot_gclr *= shade_factor;
06197 bot_bclr *= shade_factor;
06198 ;
06199 }
06200
06201 #ifdef DEBUG
06202 if (ipixel == trace_pixel_ptr) {
06203 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
06204 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
06205 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
06206 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
06207 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
06208 }
06209 #endif
06210 ;
06211
06212 acc_opc = top_opc * wgtTL;
06213
06214 acc_rclr = top_rclr * wgtTL;
06215 acc_gclr = top_gclr * wgtTL;
06216 acc_bclr = top_bclr * wgtTL;
06217
06218 #ifdef DEBUG
06219 if (ipixel == trace_pixel_ptr) {
06220 trace_opcTL = top_opc;
06221 trace_rclrTL = top_rclr;
06222 trace_gclrTL = top_gclr;
06223 trace_bclrTL = top_bclr;
06224
06225 }
06226 #endif
06227 ;
06228
06229 acc_opc += bot_opc * wgtBL;
06230
06231 acc_rclr += bot_rclr * wgtBL;
06232 acc_gclr += bot_gclr * wgtBL;
06233 acc_bclr += bot_bclr * wgtBL;
06234
06235 #ifdef DEBUG
06236 if (ipixel == trace_pixel_ptr) {
06237 trace_opcBL = bot_opc;
06238 trace_rclrBL = bot_rclr;
06239 trace_gclrBL = bot_gclr;
06240 trace_bclrBL = bot_bclr;
06241
06242 }
06243 #endif
06244 ;
06245
06246
06247 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
06248 opacity = param0_table[opac_param];
06249 if (param1_size != 0) {
06250 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
06251 opacity *= param1_table[opac_param];
06252 if (param2_size != 0) {
06253 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
06254 opacity *= param2_table[opac_param];
06255 }
06256 }
06257 if (opacity > min_opacity) {
06258 opacity_int = opacity*255.;
06259 top_opc = opac_correct[opacity_int];
06260 } else {
06261 top_opc = (float)0.;
06262 };
06263
06264
06265 shade_index=2*3*ShortField(topRLEdata,norm_offset);
06266 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
06267
06268
06269
06270 top_rclr =
06271 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06272
06273 top_gclr =
06274 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06275
06276 top_bclr =
06277 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06278 ;
06279 ;
06280 ;
06281
06282
06283 top_rclr +=
06284 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06285
06286 top_gclr +=
06287 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06288
06289 top_bclr +=
06290 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06291 ;
06292 ;
06293 ;
06294 shade_factor = top_opc * slice_depth_cueing;
06295
06296 top_rclr *= shade_factor;
06297 top_gclr *= shade_factor;
06298 top_bclr *= shade_factor;
06299 ;
06300
06301
06302 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
06303 opacity = param0_table[opac_param];
06304 if (param1_size != 0) {
06305 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
06306 opacity *= param1_table[opac_param];
06307 if (param2_size != 0) {
06308 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
06309 opacity *= param2_table[opac_param];
06310 }
06311 }
06312 if (opacity > min_opacity) {
06313 opacity_int = opacity*255.;
06314 bot_opc = opac_correct[opacity_int];
06315 } else {
06316 bot_opc = (float)0.;
06317 };
06318
06319
06320 shade_index=2*3*ShortField(botRLEdata,norm_offset);
06321 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
06322
06323
06324
06325 bot_rclr =
06326 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06327
06328 bot_gclr =
06329 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06330
06331 bot_bclr =
06332 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06333 ;
06334 ;
06335 ;
06336
06337
06338 bot_rclr +=
06339 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06340
06341 bot_gclr +=
06342 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06343
06344 bot_bclr +=
06345 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06346 ;
06347 ;
06348 ;
06349 shade_factor = bot_opc * slice_depth_cueing;
06350
06351 bot_rclr *= shade_factor;
06352 bot_gclr *= shade_factor;
06353 bot_bclr *= shade_factor;
06354 ;
06355
06356 acc_opc += top_opc * wgtTR;
06357
06358 acc_rclr += top_rclr * wgtTR;
06359 acc_gclr += top_gclr * wgtTR;
06360 acc_bclr += top_bclr * wgtTR;
06361
06362 #ifdef DEBUG
06363 if (ipixel == trace_pixel_ptr) {
06364 trace_opcTR = top_opc;
06365 trace_rclrTR = top_rclr;
06366 trace_gclrTR = top_gclr;
06367 trace_bclrTR = top_bclr;
06368
06369 }
06370 #endif
06371 ;
06372
06373 acc_opc += bot_opc * wgtBR;
06374
06375 acc_rclr += bot_rclr * wgtBR;
06376 acc_gclr += bot_gclr * wgtBR;
06377 acc_bclr += bot_bclr * wgtBR;
06378
06379 #ifdef DEBUG
06380 if (ipixel == trace_pixel_ptr) {
06381 trace_opcBR = bot_opc;
06382 trace_rclrBR = bot_rclr;
06383 trace_gclrBR = bot_gclr;
06384 trace_bclrBR = bot_bclr;
06385
06386 }
06387 #endif
06388 ;
06389
06390 COUNT_RESAMPLE;
06391 if (acc_opc > min_opacity) {
06392 COUNT_COMPOSITE;
06393 iopc = ipixel->opcflt;
06394 # ifndef SKIP_ERT
06395 ASSERT(iopc < max_opacity);
06396 # endif
06397 iopc_inv = (float)1. - iopc;
06398
06399 ipixel->rclrflt += acc_rclr * iopc_inv;
06400 ipixel->gclrflt += acc_gclr * iopc_inv;
06401 ipixel->bclrflt += acc_bclr * iopc_inv;
06402 iopc += acc_opc * iopc_inv;
06403 ipixel->opcflt = iopc;
06404
06405 #ifdef DEBUG
06406 if (ipixel == trace_pixel_ptr) {
06407 #ifdef COMPUTE_SHADOW_BUFFER
06408 printf("{%3d} %3d %3d", k, icount-i-count, j);
06409 #else
06410 printf("[%3d] %3d %3d", k, icount-i-count, j);
06411 #endif
06412 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
06413 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
06414 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
06415 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
06416 printf(" %3.0f %3.0f\n", iopc*255.,
06417 ipixel->rclrflt);
06418
06419
06420 printf(" ");
06421 printf(" %3.0f ",trace_gclrTL);
06422 printf(" %3.0f ",trace_gclrBL);
06423 printf(" %3.0f ",trace_gclrTR);
06424 printf(" %3.0f ",trace_gclrBR);
06425 printf(" %3.0f\n", ipixel->gclrflt);
06426 printf(" ");
06427 printf(" %3.0f ",trace_bclrTL);
06428 printf(" %3.0f ",trace_bclrBL);
06429 printf(" %3.0f ",trace_bclrTR);
06430 printf(" %3.0f ",trace_bclrBR);
06431 printf(" %3.0f\n", ipixel->bclrflt);
06432 }
06433 #endif
06434 ;
06435 # ifndef SKIP_ERT
06436 if (iopc >= max_opacity) {
06437 ASSERT(ipixel->lnk == 0);
06438 ipixel->lnk = 1;
06439 }
06440 # endif
06441 };
06442 ipixel += 1;
06443 topRLEdata += 1 * voxel_istride;
06444 botRLEdata += 1 * voxel_istride;
06445 count--;
06446 SET_VOXELS_LOADED;
06447 }
06448 break;
06449 case ALL_NONZERO__ALL_NONZERO:
06450
06451 while (count > 0) {
06452 if (PIXEL_IS_OPAQUE(ipixel))
06453 break;
06454 if (!voxels_loaded) {
06455
06456
06457 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
06458 opacity = param0_table[opac_param];
06459 if (param1_size != 0) {
06460 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
06461 opacity *= param1_table[opac_param];
06462 if (param2_size != 0) {
06463 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
06464 opacity *= param2_table[opac_param];
06465 }
06466 }
06467 if (opacity > min_opacity) {
06468 opacity_int = opacity*255.;
06469 top_opc = opac_correct[opacity_int];
06470 } else {
06471 top_opc = (float)0.;
06472 };
06473
06474
06475 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
06476 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
06477
06478
06479
06480 top_rclr =
06481 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06482
06483 top_gclr =
06484 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06485
06486 top_bclr =
06487 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06488 ;
06489 ;
06490 ;
06491
06492
06493 top_rclr +=
06494 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06495
06496 top_gclr +=
06497 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06498
06499 top_bclr +=
06500 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06501 ;
06502 ;
06503 ;
06504 shade_factor = top_opc * slice_depth_cueing;
06505
06506 top_rclr *= shade_factor;
06507 top_gclr *= shade_factor;
06508 top_bclr *= shade_factor;
06509 ;
06510
06511
06512 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
06513 opacity = param0_table[opac_param];
06514 if (param1_size != 0) {
06515 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
06516 opacity *= param1_table[opac_param];
06517 if (param2_size != 0) {
06518 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
06519 opacity *= param2_table[opac_param];
06520 }
06521 }
06522 if (opacity > min_opacity) {
06523 opacity_int = opacity*255.;
06524 bot_opc = opac_correct[opacity_int];
06525 } else {
06526 bot_opc = (float)0.;
06527 };
06528
06529
06530 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
06531 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
06532
06533
06534
06535 bot_rclr =
06536 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06537
06538 bot_gclr =
06539 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06540
06541 bot_bclr =
06542 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06543 ;
06544 ;
06545 ;
06546
06547
06548 bot_rclr +=
06549 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06550
06551 bot_gclr +=
06552 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06553
06554 bot_bclr +=
06555 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06556 ;
06557 ;
06558 ;
06559 shade_factor = bot_opc * slice_depth_cueing;
06560
06561 bot_rclr *= shade_factor;
06562 bot_gclr *= shade_factor;
06563 bot_bclr *= shade_factor;
06564 ;
06565 }
06566
06567 #ifdef DEBUG
06568 if (ipixel == trace_pixel_ptr) {
06569 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
06570 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
06571 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
06572 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
06573 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
06574 }
06575 #endif
06576 ;
06577
06578 acc_opc = top_opc * wgtTL;
06579
06580 acc_rclr = top_rclr * wgtTL;
06581 acc_gclr = top_gclr * wgtTL;
06582 acc_bclr = top_bclr * wgtTL;
06583
06584 #ifdef DEBUG
06585 if (ipixel == trace_pixel_ptr) {
06586 trace_opcTL = top_opc;
06587 trace_rclrTL = top_rclr;
06588 trace_gclrTL = top_gclr;
06589 trace_bclrTL = top_bclr;
06590
06591 }
06592 #endif
06593 ;
06594
06595 acc_opc += bot_opc * wgtBL;
06596
06597 acc_rclr += bot_rclr * wgtBL;
06598 acc_gclr += bot_gclr * wgtBL;
06599 acc_bclr += bot_bclr * wgtBL;
06600
06601 #ifdef DEBUG
06602 if (ipixel == trace_pixel_ptr) {
06603 trace_opcBL = bot_opc;
06604 trace_rclrBL = bot_rclr;
06605 trace_gclrBL = bot_gclr;
06606 trace_bclrBL = bot_bclr;
06607
06608 }
06609 #endif
06610 ;
06611
06612
06613 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
06614 opacity = param0_table[opac_param];
06615 if (param1_size != 0) {
06616 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
06617 opacity *= param1_table[opac_param];
06618 if (param2_size != 0) {
06619 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
06620 opacity *= param2_table[opac_param];
06621 }
06622 }
06623 if (opacity > min_opacity) {
06624 opacity_int = opacity*255.;
06625 top_opc = opac_correct[opacity_int];
06626 } else {
06627 top_opc = (float)0.;
06628 };
06629
06630
06631 shade_index=2*3*ShortField(topRLEdata,norm_offset);
06632 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
06633
06634
06635
06636 top_rclr =
06637 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06638
06639 top_gclr =
06640 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06641
06642 top_bclr =
06643 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06644 ;
06645 ;
06646 ;
06647
06648
06649 top_rclr +=
06650 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06651
06652 top_gclr +=
06653 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06654
06655 top_bclr +=
06656 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06657 ;
06658 ;
06659 ;
06660 shade_factor = top_opc * slice_depth_cueing;
06661
06662 top_rclr *= shade_factor;
06663 top_gclr *= shade_factor;
06664 top_bclr *= shade_factor;
06665 ;
06666
06667
06668 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
06669 opacity = param0_table[opac_param];
06670 if (param1_size != 0) {
06671 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
06672 opacity *= param1_table[opac_param];
06673 if (param2_size != 0) {
06674 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
06675 opacity *= param2_table[opac_param];
06676 }
06677 }
06678 if (opacity > min_opacity) {
06679 opacity_int = opacity*255.;
06680 bot_opc = opac_correct[opacity_int];
06681 } else {
06682 bot_opc = (float)0.;
06683 };
06684
06685
06686 shade_index=2*3*ShortField(botRLEdata,norm_offset);
06687 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
06688
06689
06690
06691 bot_rclr =
06692 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06693
06694 bot_gclr =
06695 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06696
06697 bot_bclr =
06698 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06699 ;
06700 ;
06701 ;
06702
06703
06704 bot_rclr +=
06705 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06706
06707 bot_gclr +=
06708 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06709
06710 bot_bclr +=
06711 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06712 ;
06713 ;
06714 ;
06715 shade_factor = bot_opc * slice_depth_cueing;
06716
06717 bot_rclr *= shade_factor;
06718 bot_gclr *= shade_factor;
06719 bot_bclr *= shade_factor;
06720 ;
06721
06722 acc_opc += top_opc * wgtTR;
06723
06724 acc_rclr += top_rclr * wgtTR;
06725 acc_gclr += top_gclr * wgtTR;
06726 acc_bclr += top_bclr * wgtTR;
06727
06728 #ifdef DEBUG
06729 if (ipixel == trace_pixel_ptr) {
06730 trace_opcTR = top_opc;
06731 trace_rclrTR = top_rclr;
06732 trace_gclrTR = top_gclr;
06733 trace_bclrTR = top_bclr;
06734
06735 }
06736 #endif
06737 ;
06738
06739 acc_opc += bot_opc * wgtBR;
06740
06741 acc_rclr += bot_rclr * wgtBR;
06742 acc_gclr += bot_gclr * wgtBR;
06743 acc_bclr += bot_bclr * wgtBR;
06744
06745 #ifdef DEBUG
06746 if (ipixel == trace_pixel_ptr) {
06747 trace_opcBR = bot_opc;
06748 trace_rclrBR = bot_rclr;
06749 trace_gclrBR = bot_gclr;
06750 trace_bclrBR = bot_bclr;
06751
06752 }
06753 #endif
06754 ;
06755
06756 COUNT_RESAMPLE;
06757 if (acc_opc > min_opacity) {
06758 COUNT_COMPOSITE;
06759 iopc = ipixel->opcflt;
06760 # ifndef SKIP_ERT
06761 ASSERT(iopc < max_opacity);
06762 # endif
06763 iopc_inv = (float)1. - iopc;
06764
06765 ipixel->rclrflt += acc_rclr * iopc_inv;
06766 ipixel->gclrflt += acc_gclr * iopc_inv;
06767 ipixel->bclrflt += acc_bclr * iopc_inv;
06768 iopc += acc_opc * iopc_inv;
06769 ipixel->opcflt = iopc;
06770
06771 #ifdef DEBUG
06772 if (ipixel == trace_pixel_ptr) {
06773 #ifdef COMPUTE_SHADOW_BUFFER
06774 printf("{%3d} %3d %3d", k, icount-i-count, j);
06775 #else
06776 printf("[%3d] %3d %3d", k, icount-i-count, j);
06777 #endif
06778 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
06779 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
06780 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
06781 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
06782 printf(" %3.0f %3.0f\n", iopc*255.,
06783 ipixel->rclrflt);
06784
06785
06786 printf(" ");
06787 printf(" %3.0f ",trace_gclrTL);
06788 printf(" %3.0f ",trace_gclrBL);
06789 printf(" %3.0f ",trace_gclrTR);
06790 printf(" %3.0f ",trace_gclrBR);
06791 printf(" %3.0f\n", ipixel->gclrflt);
06792 printf(" ");
06793 printf(" %3.0f ",trace_bclrTL);
06794 printf(" %3.0f ",trace_bclrBL);
06795 printf(" %3.0f ",trace_bclrTR);
06796 printf(" %3.0f ",trace_bclrBR);
06797 printf(" %3.0f\n", ipixel->bclrflt);
06798 }
06799 #endif
06800 ;
06801 # ifndef SKIP_ERT
06802 if (iopc >= max_opacity) {
06803 ASSERT(ipixel->lnk == 0);
06804 ipixel->lnk = 1;
06805 }
06806 # endif
06807 };
06808 ipixel += 1;
06809 topRLEdata += 1 * voxel_istride;
06810 botRLEdata += 1 * voxel_istride;
06811 count--;
06812 SET_VOXELS_LOADED;
06813 }
06814 break;
06815 default:
06816 VPBug("illegal value for run states in compositing loop");
06817 }
06818 #else
06819
06820 while (count > 0) {
06821 if (last_run_state == ALL_ZERO && run_state == ALL_ZERO) {
06822 ipixel += count;
06823 if (i != -1) {
06824 topRLEdata += count * voxel_istride;
06825 botRLEdata += count * voxel_istride;
06826 }
06827 count = 0;
06828 break;
06829 }
06830 if (ipixel->lnk != 0)
06831 break;
06832
06833 #ifdef DEBUG
06834 if (ipixel == trace_pixel_ptr) {
06835 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
06836 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
06837 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
06838 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
06839 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
06840 }
06841 #endif
06842 ;
06843
06844 acc_opc = 0;
06845 acc_rclr = acc_gclr = acc_bclr = 0;
06846 if (last_run_state & TOP_NONZERO) {
06847 if (!voxels_loaded) {
06848
06849
06850 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
06851 opacity = param0_table[opac_param];
06852 if (param1_size != 0) {
06853 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
06854 opacity *= param1_table[opac_param];
06855 if (param2_size != 0) {
06856 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
06857 opacity *= param2_table[opac_param];
06858 }
06859 }
06860 if (opacity > min_opacity) {
06861 opacity_int = opacity*255.;
06862 top_opc = opac_correct[opacity_int];
06863 } else {
06864 top_opc = (float)0.;
06865 };
06866
06867
06868 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
06869 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
06870
06871
06872
06873 top_rclr =
06874 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06875
06876 top_gclr =
06877 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06878
06879 top_bclr =
06880 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06881 ;
06882 ;
06883 ;
06884
06885
06886 top_rclr +=
06887 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06888
06889 top_gclr +=
06890 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06891
06892 top_bclr +=
06893 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06894 ;
06895 ;
06896 ;
06897 shade_factor = top_opc * slice_depth_cueing;
06898
06899 top_rclr *= shade_factor;
06900 top_gclr *= shade_factor;
06901 top_bclr *= shade_factor;
06902 ;
06903 }
06904
06905 acc_opc += top_opc * wgtTL;
06906
06907 acc_rclr += top_rclr * wgtTL;
06908 acc_gclr += top_gclr * wgtTL;
06909 acc_bclr += top_bclr * wgtTL;
06910
06911 #ifdef DEBUG
06912 if (ipixel == trace_pixel_ptr) {
06913 trace_opcTL = top_opc;
06914 trace_rclrTL = top_rclr;
06915 trace_gclrTL = top_gclr;
06916 trace_bclrTL = top_bclr;
06917
06918 }
06919 #endif
06920 ;
06921 }
06922 if (last_run_state & BOT_NONZERO) {
06923 if (!voxels_loaded) {
06924
06925
06926 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
06927 opacity = param0_table[opac_param];
06928 if (param1_size != 0) {
06929 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
06930 opacity *= param1_table[opac_param];
06931 if (param2_size != 0) {
06932 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
06933 opacity *= param2_table[opac_param];
06934 }
06935 }
06936 if (opacity > min_opacity) {
06937 opacity_int = opacity*255.;
06938 bot_opc = opac_correct[opacity_int];
06939 } else {
06940 bot_opc = (float)0.;
06941 };
06942
06943
06944 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
06945 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
06946
06947
06948
06949 bot_rclr =
06950 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
06951
06952 bot_gclr =
06953 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
06954
06955 bot_bclr =
06956 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
06957 ;
06958 ;
06959 ;
06960
06961
06962 bot_rclr +=
06963 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
06964
06965 bot_gclr +=
06966 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
06967
06968 bot_bclr +=
06969 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
06970 ;
06971 ;
06972 ;
06973 shade_factor = bot_opc * slice_depth_cueing;
06974
06975 bot_rclr *= shade_factor;
06976 bot_gclr *= shade_factor;
06977 bot_bclr *= shade_factor;
06978 ;
06979 }
06980
06981 acc_opc += bot_opc * wgtBL;
06982
06983 acc_rclr += bot_rclr * wgtBL;
06984 acc_gclr += bot_gclr * wgtBL;
06985 acc_bclr += bot_bclr * wgtBL;
06986
06987 #ifdef DEBUG
06988 if (ipixel == trace_pixel_ptr) {
06989 trace_opcBL = bot_opc;
06990 trace_rclrBL = bot_rclr;
06991 trace_gclrBL = bot_gclr;
06992 trace_bclrBL = bot_bclr;
06993
06994 }
06995 #endif
06996 ;
06997 }
06998 if (run_state & TOP_NONZERO) {
06999
07000
07001 opac_param = VoxelField(topRLEdata, param0_offset, param0_size);
07002 opacity = param0_table[opac_param];
07003 if (param1_size != 0) {
07004 opac_param = VoxelField(topRLEdata, param1_offset, param1_size);
07005 opacity *= param1_table[opac_param];
07006 if (param2_size != 0) {
07007 opac_param = VoxelField(topRLEdata, param2_offset, param2_size);
07008 opacity *= param2_table[opac_param];
07009 }
07010 }
07011 if (opacity > min_opacity) {
07012 opacity_int = opacity*255.;
07013 top_opc = opac_correct[opacity_int];
07014 } else {
07015 top_opc = (float)0.;
07016 };
07017
07018
07019 shade_index=2*3*ShortField(topRLEdata,norm_offset);
07020 weight_index = 2 * ByteField(topRLEdata, wgt_offset);
07021
07022
07023
07024 top_rclr =
07025 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
07026
07027 top_gclr =
07028 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
07029
07030 top_bclr =
07031 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
07032 ;
07033 ;
07034 ;
07035
07036
07037 top_rclr +=
07038 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
07039
07040 top_gclr +=
07041 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
07042
07043 top_bclr +=
07044 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
07045 ;
07046 ;
07047 ;
07048 shade_factor = top_opc * slice_depth_cueing;
07049
07050 top_rclr *= shade_factor;
07051 top_gclr *= shade_factor;
07052 top_bclr *= shade_factor;
07053 ;
07054
07055 acc_opc += top_opc * wgtTR;
07056
07057 acc_rclr += top_rclr * wgtTR;
07058 acc_gclr += top_gclr * wgtTR;
07059 acc_bclr += top_bclr * wgtTR;
07060
07061 #ifdef DEBUG
07062 if (ipixel == trace_pixel_ptr) {
07063 trace_opcTR = top_opc;
07064 trace_rclrTR = top_rclr;
07065 trace_gclrTR = top_gclr;
07066 trace_bclrTR = top_bclr;
07067
07068 }
07069 #endif
07070 ;
07071 topRLEdata += 1 * voxel_istride;
07072 } else {
07073 if (i != -1) {
07074 topRLEdata += 1 * voxel_istride;
07075 }
07076 }
07077 if (run_state & BOT_NONZERO) {
07078
07079
07080 opac_param = VoxelField(botRLEdata, param0_offset, param0_size);
07081 opacity = param0_table[opac_param];
07082 if (param1_size != 0) {
07083 opac_param = VoxelField(botRLEdata, param1_offset, param1_size);
07084 opacity *= param1_table[opac_param];
07085 if (param2_size != 0) {
07086 opac_param = VoxelField(botRLEdata, param2_offset, param2_size);
07087 opacity *= param2_table[opac_param];
07088 }
07089 }
07090 if (opacity > min_opacity) {
07091 opacity_int = opacity*255.;
07092 bot_opc = opac_correct[opacity_int];
07093 } else {
07094 bot_opc = (float)0.;
07095 };
07096
07097
07098 shade_index=2*3*ShortField(botRLEdata,norm_offset);
07099 weight_index = 2 * ByteField(botRLEdata, wgt_offset);
07100
07101
07102
07103 bot_rclr =
07104 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
07105
07106 bot_gclr =
07107 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
07108
07109 bot_bclr =
07110 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
07111 ;
07112 ;
07113 ;
07114
07115
07116 bot_rclr +=
07117 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
07118
07119 bot_gclr +=
07120 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
07121
07122 bot_bclr +=
07123 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
07124 ;
07125 ;
07126 ;
07127 shade_factor = bot_opc * slice_depth_cueing;
07128
07129 bot_rclr *= shade_factor;
07130 bot_gclr *= shade_factor;
07131 bot_bclr *= shade_factor;
07132 ;
07133
07134 acc_opc += bot_opc * wgtBR;
07135
07136 acc_rclr += bot_rclr * wgtBR;
07137 acc_gclr += bot_gclr * wgtBR;
07138 acc_bclr += bot_bclr * wgtBR;
07139
07140 #ifdef DEBUG
07141 if (ipixel == trace_pixel_ptr) {
07142 trace_opcBR = bot_opc;
07143 trace_rclrBR = bot_rclr;
07144 trace_gclrBR = bot_gclr;
07145 trace_bclrBR = bot_bclr;
07146
07147 }
07148 #endif
07149 ;
07150 botRLEdata += 1 * voxel_istride;
07151 } else {
07152 if (i != -1) {
07153 botRLEdata += 1 * voxel_istride;
07154 }
07155 }
07156
07157 COUNT_RESAMPLE;
07158 if (acc_opc > min_opacity) {
07159 COUNT_COMPOSITE;
07160 iopc = ipixel->opcflt;
07161 # ifndef SKIP_ERT
07162 ASSERT(iopc < max_opacity);
07163 # endif
07164 iopc_inv = (float)1. - iopc;
07165
07166 ipixel->rclrflt += acc_rclr * iopc_inv;
07167 ipixel->gclrflt += acc_gclr * iopc_inv;
07168 ipixel->bclrflt += acc_bclr * iopc_inv;
07169 iopc += acc_opc * iopc_inv;
07170 ipixel->opcflt = iopc;
07171
07172 #ifdef DEBUG
07173 if (ipixel == trace_pixel_ptr) {
07174 #ifdef COMPUTE_SHADOW_BUFFER
07175 printf("{%3d} %3d %3d", k, icount-i-count, j);
07176 #else
07177 printf("[%3d] %3d %3d", k, icount-i-count, j);
07178 #endif
07179 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
07180 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
07181 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
07182 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
07183 printf(" %3.0f %3.0f\n", iopc*255.,
07184 ipixel->rclrflt);
07185
07186
07187 printf(" ");
07188 printf(" %3.0f ",trace_gclrTL);
07189 printf(" %3.0f ",trace_gclrBL);
07190 printf(" %3.0f ",trace_gclrTR);
07191 printf(" %3.0f ",trace_gclrBR);
07192 printf(" %3.0f\n", ipixel->gclrflt);
07193 printf(" ");
07194 printf(" %3.0f ",trace_bclrTL);
07195 printf(" %3.0f ",trace_bclrBL);
07196 printf(" %3.0f ",trace_bclrTR);
07197 printf(" %3.0f ",trace_bclrBR);
07198 printf(" %3.0f\n", ipixel->bclrflt);
07199 }
07200 #endif
07201 ;
07202 # ifndef SKIP_ERT
07203 if (iopc >= max_opacity) {
07204 ASSERT(ipixel->lnk == 0);
07205 ipixel->lnk = 1;
07206 }
07207 # endif
07208 };
07209 ipixel += 1;
07210 count--;
07211 SET_VOXELS_LOADED;
07212 last_run_state = run_state;
07213 }
07214 #endif
07215
07216 GET_HIRES_TIME(vpc, t1);
07217 STORE_HIRES_TIME(vpc, VPTIMER_PROCESS_VOXELS, t0, t1);
07218 COPY_HIRES_TIME(t0, t1);
07219
07220 if (count > 0) {
07221 Debug((vpc, VPDEBUG_COMPOSITE, "Backup(%d)\n", count));
07222 toprun_count += count;
07223 botrun_count += count;
07224 i += count;
07225 }
07226 #endif
07227
07228
07229
07230
07231
07232 last_run_state = run_state;
07233 }
07234
07235
07236
07237
07238
07239 #ifdef UNROLL_RUN_LOOP
07240 ASSERT(i == 0);
07241 #else
07242 ASSERT(i == -1);
07243 #endif
07244
07245 #ifndef SKIP_COMPOSITE
07246 #ifdef UNROLL_RUN_LOOP
07247
07248 if (last_run_state != ALL_ZERO && !PIXEL_IS_OPAQUE(ipixel)) {
07249
07250
07251 Debug((vpc, VPDEBUG_COMPOSITE, "Run(1)End\n"));
07252 switch (last_run_state) {
07253 case TOP_NONZERO:
07254
07255 if (!voxels_loaded) {
07256
07257
07258 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
07259 opacity = param0_table[opac_param];
07260 if (param1_size != 0) {
07261 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
07262 opacity *= param1_table[opac_param];
07263 if (param2_size != 0) {
07264 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
07265 opacity *= param2_table[opac_param];
07266 }
07267 }
07268 if (opacity > min_opacity) {
07269 opacity_int = opacity*255.;
07270 top_opc = opac_correct[opacity_int];
07271 } else {
07272 top_opc = (float)0.;
07273 };
07274
07275
07276 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
07277 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
07278
07279
07280
07281 top_rclr =
07282 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
07283
07284 top_gclr =
07285 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
07286
07287 top_bclr =
07288 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
07289 ;
07290 ;
07291 ;
07292
07293
07294 top_rclr +=
07295 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
07296
07297 top_gclr +=
07298 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
07299
07300 top_bclr +=
07301 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
07302 ;
07303 ;
07304 ;
07305 shade_factor = top_opc * slice_depth_cueing;
07306
07307 top_rclr *= shade_factor;
07308 top_gclr *= shade_factor;
07309 top_bclr *= shade_factor;
07310 ;
07311 }
07312
07313 #ifdef DEBUG
07314 if (ipixel == trace_pixel_ptr) {
07315 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
07316 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
07317 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
07318 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
07319 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
07320 }
07321 #endif
07322 ;
07323
07324 acc_opc = top_opc * wgtTL;
07325
07326 acc_rclr = top_rclr * wgtTL;
07327 acc_gclr = top_gclr * wgtTL;
07328 acc_bclr = top_bclr * wgtTL;
07329
07330 #ifdef DEBUG
07331 if (ipixel == trace_pixel_ptr) {
07332 trace_opcTL = top_opc;
07333 trace_rclrTL = top_rclr;
07334 trace_gclrTL = top_gclr;
07335 trace_bclrTL = top_bclr;
07336
07337 }
07338 #endif
07339 ;
07340
07341 COUNT_RESAMPLE;
07342 if (acc_opc > min_opacity) {
07343 COUNT_COMPOSITE;
07344 iopc = ipixel->opcflt;
07345 # ifndef SKIP_ERT
07346 ASSERT(iopc < max_opacity);
07347 # endif
07348 iopc_inv = (float)1. - iopc;
07349
07350 ipixel->rclrflt += acc_rclr * iopc_inv;
07351 ipixel->gclrflt += acc_gclr * iopc_inv;
07352 ipixel->bclrflt += acc_bclr * iopc_inv;
07353 iopc += acc_opc * iopc_inv;
07354 ipixel->opcflt = iopc;
07355
07356 #ifdef DEBUG
07357 if (ipixel == trace_pixel_ptr) {
07358 #ifdef COMPUTE_SHADOW_BUFFER
07359 printf("{%3d} %3d %3d", k, icount-i-count, j);
07360 #else
07361 printf("[%3d] %3d %3d", k, icount-i-count, j);
07362 #endif
07363 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
07364 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
07365 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
07366 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
07367 printf(" %3.0f %3.0f\n", iopc*255.,
07368 ipixel->rclrflt);
07369
07370
07371 printf(" ");
07372 printf(" %3.0f ",trace_gclrTL);
07373 printf(" %3.0f ",trace_gclrBL);
07374 printf(" %3.0f ",trace_gclrTR);
07375 printf(" %3.0f ",trace_gclrBR);
07376 printf(" %3.0f\n", ipixel->gclrflt);
07377 printf(" ");
07378 printf(" %3.0f ",trace_bclrTL);
07379 printf(" %3.0f ",trace_bclrBL);
07380 printf(" %3.0f ",trace_bclrTR);
07381 printf(" %3.0f ",trace_bclrBR);
07382 printf(" %3.0f\n", ipixel->bclrflt);
07383 }
07384 #endif
07385 ;
07386 # ifndef SKIP_ERT
07387 if (iopc >= max_opacity) {
07388 ASSERT(ipixel->lnk == 0);
07389 ipixel->lnk = 1;
07390 }
07391 # endif
07392 };
07393 break;
07394 case BOT_NONZERO:
07395
07396 if (!voxels_loaded) {
07397
07398
07399 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
07400 opacity = param0_table[opac_param];
07401 if (param1_size != 0) {
07402 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
07403 opacity *= param1_table[opac_param];
07404 if (param2_size != 0) {
07405 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
07406 opacity *= param2_table[opac_param];
07407 }
07408 }
07409 if (opacity > min_opacity) {
07410 opacity_int = opacity*255.;
07411 bot_opc = opac_correct[opacity_int];
07412 } else {
07413 bot_opc = (float)0.;
07414 };
07415
07416
07417 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
07418 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
07419
07420
07421
07422 bot_rclr =
07423 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
07424
07425 bot_gclr =
07426 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
07427
07428 bot_bclr =
07429 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
07430 ;
07431 ;
07432 ;
07433
07434
07435 bot_rclr +=
07436 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
07437
07438 bot_gclr +=
07439 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
07440
07441 bot_bclr +=
07442 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
07443 ;
07444 ;
07445 ;
07446 shade_factor = bot_opc * slice_depth_cueing;
07447
07448 bot_rclr *= shade_factor;
07449 bot_gclr *= shade_factor;
07450 bot_bclr *= shade_factor;
07451 ;
07452 }
07453
07454 #ifdef DEBUG
07455 if (ipixel == trace_pixel_ptr) {
07456 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
07457 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
07458 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
07459 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
07460 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
07461 }
07462 #endif
07463 ;
07464
07465 acc_opc = bot_opc * wgtBL;
07466
07467 acc_rclr = bot_rclr * wgtBL;
07468 acc_gclr = bot_gclr * wgtBL;
07469 acc_bclr = bot_bclr * wgtBL;
07470
07471 #ifdef DEBUG
07472 if (ipixel == trace_pixel_ptr) {
07473 trace_opcBL = bot_opc;
07474 trace_rclrBL = bot_rclr;
07475 trace_gclrBL = bot_gclr;
07476 trace_bclrBL = bot_bclr;
07477
07478 }
07479 #endif
07480 ;
07481
07482 COUNT_RESAMPLE;
07483 if (acc_opc > min_opacity) {
07484 COUNT_COMPOSITE;
07485 iopc = ipixel->opcflt;
07486 # ifndef SKIP_ERT
07487 ASSERT(iopc < max_opacity);
07488 # endif
07489 iopc_inv = (float)1. - iopc;
07490
07491 ipixel->rclrflt += acc_rclr * iopc_inv;
07492 ipixel->gclrflt += acc_gclr * iopc_inv;
07493 ipixel->bclrflt += acc_bclr * iopc_inv;
07494 iopc += acc_opc * iopc_inv;
07495 ipixel->opcflt = iopc;
07496
07497 #ifdef DEBUG
07498 if (ipixel == trace_pixel_ptr) {
07499 #ifdef COMPUTE_SHADOW_BUFFER
07500 printf("{%3d} %3d %3d", k, icount-i-count, j);
07501 #else
07502 printf("[%3d] %3d %3d", k, icount-i-count, j);
07503 #endif
07504 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
07505 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
07506 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
07507 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
07508 printf(" %3.0f %3.0f\n", iopc*255.,
07509 ipixel->rclrflt);
07510
07511
07512 printf(" ");
07513 printf(" %3.0f ",trace_gclrTL);
07514 printf(" %3.0f ",trace_gclrBL);
07515 printf(" %3.0f ",trace_gclrTR);
07516 printf(" %3.0f ",trace_gclrBR);
07517 printf(" %3.0f\n", ipixel->gclrflt);
07518 printf(" ");
07519 printf(" %3.0f ",trace_bclrTL);
07520 printf(" %3.0f ",trace_bclrBL);
07521 printf(" %3.0f ",trace_bclrTR);
07522 printf(" %3.0f ",trace_bclrBR);
07523 printf(" %3.0f\n", ipixel->bclrflt);
07524 }
07525 #endif
07526 ;
07527 # ifndef SKIP_ERT
07528 if (iopc >= max_opacity) {
07529 ASSERT(ipixel->lnk == 0);
07530 ipixel->lnk = 1;
07531 }
07532 # endif
07533 };
07534 break;
07535 case ALL_NONZERO:
07536
07537 if (!voxels_loaded) {
07538
07539
07540 opac_param = VoxelField(topRLEdata - voxel_istride, param0_offset, param0_size);
07541 opacity = param0_table[opac_param];
07542 if (param1_size != 0) {
07543 opac_param = VoxelField(topRLEdata - voxel_istride, param1_offset, param1_size);
07544 opacity *= param1_table[opac_param];
07545 if (param2_size != 0) {
07546 opac_param = VoxelField(topRLEdata - voxel_istride, param2_offset, param2_size);
07547 opacity *= param2_table[opac_param];
07548 }
07549 }
07550 if (opacity > min_opacity) {
07551 opacity_int = opacity*255.;
07552 top_opc = opac_correct[opacity_int];
07553 } else {
07554 top_opc = (float)0.;
07555 };
07556
07557
07558 shade_index=2*3*ShortField(topRLEdata - voxel_istride,norm_offset);
07559 weight_index = 2 * ByteField(topRLEdata - voxel_istride, wgt_offset);
07560
07561
07562
07563 top_rclr =
07564 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
07565
07566 top_gclr =
07567 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
07568
07569 top_bclr =
07570 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
07571 ;
07572 ;
07573 ;
07574
07575
07576 top_rclr +=
07577 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
07578
07579 top_gclr +=
07580 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
07581
07582 top_bclr +=
07583 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
07584 ;
07585 ;
07586 ;
07587 shade_factor = top_opc * slice_depth_cueing;
07588
07589 top_rclr *= shade_factor;
07590 top_gclr *= shade_factor;
07591 top_bclr *= shade_factor;
07592 ;
07593
07594
07595 opac_param = VoxelField(botRLEdata - voxel_istride, param0_offset, param0_size);
07596 opacity = param0_table[opac_param];
07597 if (param1_size != 0) {
07598 opac_param = VoxelField(botRLEdata - voxel_istride, param1_offset, param1_size);
07599 opacity *= param1_table[opac_param];
07600 if (param2_size != 0) {
07601 opac_param = VoxelField(botRLEdata - voxel_istride, param2_offset, param2_size);
07602 opacity *= param2_table[opac_param];
07603 }
07604 }
07605 if (opacity > min_opacity) {
07606 opacity_int = opacity*255.;
07607 bot_opc = opac_correct[opacity_int];
07608 } else {
07609 bot_opc = (float)0.;
07610 };
07611
07612
07613 shade_index=2*3*ShortField(botRLEdata - voxel_istride,norm_offset);
07614 weight_index = 2 * ByteField(botRLEdata - voxel_istride, wgt_offset);
07615
07616
07617
07618 bot_rclr =
07619 shade_table[shade_index + 3*0 + 0] * weight_table[weight_index + 0];
07620
07621 bot_gclr =
07622 shade_table[shade_index + 3*0 + 1] * weight_table[weight_index + 0];
07623
07624 bot_bclr =
07625 shade_table[shade_index + 3*0 + 2] * weight_table[weight_index + 0];
07626 ;
07627 ;
07628 ;
07629
07630
07631 bot_rclr +=
07632 shade_table[shade_index + 3*1 + 0] * weight_table[weight_index + 1];
07633
07634 bot_gclr +=
07635 shade_table[shade_index + 3*1 + 1] * weight_table[weight_index + 1];
07636
07637 bot_bclr +=
07638 shade_table[shade_index + 3*1 + 2] * weight_table[weight_index + 1];
07639 ;
07640 ;
07641 ;
07642 shade_factor = bot_opc * slice_depth_cueing;
07643
07644 bot_rclr *= shade_factor;
07645 bot_gclr *= shade_factor;
07646 bot_bclr *= shade_factor;
07647 ;
07648 }
07649
07650 #ifdef DEBUG
07651 if (ipixel == trace_pixel_ptr) {
07652 trace_opcTL = 0.; trace_opcBL = 0.; trace_opcTR = 0.; trace_opcBR = 0.;
07653 trace_rsclrTL=0.; trace_rsclrBL=0.; trace_rsclrTR=0.; trace_rsclrBR=0.;
07654 trace_rclrTL= 0.; trace_rclrBL= 0.; trace_rclrTR= 0.; trace_rclrBR= 0.;
07655 trace_gclrTL= 0.; trace_gclrBL= 0.; trace_gclrTR= 0.; trace_gclrBR= 0.;
07656 trace_bclrTL= 0.; trace_bclrBL= 0.; trace_bclrTR= 0.; trace_bclrBR= 0.;
07657 }
07658 #endif
07659 ;
07660
07661 acc_opc = top_opc * wgtTL;
07662
07663 acc_rclr = top_rclr * wgtTL;
07664 acc_gclr = top_gclr * wgtTL;
07665 acc_bclr = top_bclr * wgtTL;
07666
07667 #ifdef DEBUG
07668 if (ipixel == trace_pixel_ptr) {
07669 trace_opcTL = top_opc;
07670 trace_rclrTL = top_rclr;
07671 trace_gclrTL = top_gclr;
07672 trace_bclrTL = top_bclr;
07673
07674 }
07675 #endif
07676 ;
07677
07678 acc_opc += bot_opc * wgtBL;
07679
07680 acc_rclr += bot_rclr * wgtBL;
07681 acc_gclr += bot_gclr * wgtBL;
07682 acc_bclr += bot_bclr * wgtBL;
07683
07684 #ifdef DEBUG
07685 if (ipixel == trace_pixel_ptr) {
07686 trace_opcBL = bot_opc;
07687 trace_rclrBL = bot_rclr;
07688 trace_gclrBL = bot_gclr;
07689 trace_bclrBL = bot_bclr;
07690
07691 }
07692 #endif
07693 ;
07694
07695 COUNT_RESAMPLE;
07696 if (acc_opc > min_opacity) {
07697 COUNT_COMPOSITE;
07698 iopc = ipixel->opcflt;
07699 # ifndef SKIP_ERT
07700 ASSERT(iopc < max_opacity);
07701 # endif
07702 iopc_inv = (float)1. - iopc;
07703
07704 ipixel->rclrflt += acc_rclr * iopc_inv;
07705 ipixel->gclrflt += acc_gclr * iopc_inv;
07706 ipixel->bclrflt += acc_bclr * iopc_inv;
07707 iopc += acc_opc * iopc_inv;
07708 ipixel->opcflt = iopc;
07709
07710 #ifdef DEBUG
07711 if (ipixel == trace_pixel_ptr) {
07712 #ifdef COMPUTE_SHADOW_BUFFER
07713 printf("{%3d} %3d %3d", k, icount-i-count, j);
07714 #else
07715 printf("[%3d] %3d %3d", k, icount-i-count, j);
07716 #endif
07717 printf(" %3.0f %3.0f %3.0f",trace_opcTL*255.,trace_rclrTL,wgtTL*100.);
07718 printf(" %3.0f %3.0f %3.0f",trace_opcBL*255.,trace_rclrBL,wgtBL*100.);
07719 printf(" %3.0f %3.0f %3.0f",trace_opcTR*255.,trace_rclrTR,wgtTR*100.);
07720 printf(" %3.0f %3.0f %3.0f",trace_opcBR*255.,trace_rclrBR,wgtBR*100.);
07721 printf(" %3.0f %3.0f\n", iopc*255.,
07722 ipixel->rclrflt);
07723
07724
07725 printf(" ");
07726 printf(" %3.0f ",trace_gclrTL);
07727 printf(" %3.0f ",trace_gclrBL);
07728 printf(" %3.0f ",trace_gclrTR);
07729 printf(" %3.0f ",trace_gclrBR);
07730 printf(" %3.0f\n", ipixel->gclrflt);
07731 printf(" ");
07732 printf(" %3.0f ",trace_bclrTL);
07733 printf(" %3.0f ",trace_bclrBL);
07734 printf(" %3.0f ",trace_bclrTR);
07735 printf(" %3.0f ",trace_bclrBR);
07736 printf(" %3.0f\n", ipixel->bclrflt);
07737 }
07738 #endif
07739 ;
07740 # ifndef SKIP_ERT
07741 if (iopc >= max_opacity) {
07742 ASSERT(ipixel->lnk == 0);
07743 ipixel->lnk = 1;
07744 }
07745 # endif
07746 };
07747 break;
07748 default:
07749 VPBug("illegal value for run state at end of scanline");
07750 }
07751 } else if (last_run_state == ALL_ZERO) {
07752 Debug((vpc, VPDEBUG_COMPOSITE, "ZeroSkip(1)End\n"));
07753 } else {
07754 Debug((vpc, VPDEBUG_COMPOSITE, "ERTSkip(1)End\n"));
07755 }
07756 #endif
07757 #endif
07758
07759 #ifndef UNROLL_RUN_LOOP
07760 run_state = final_run_state;
07761 #endif
07762
07763 if (j != 0 && ((run_state & 1) == 0)) {
07764 toprun_count = *topRLElen++;
07765 ASSERT(toprun_count == 0);
07766 }
07767 if (j != jcount && ((run_state & 2) == 0)) {
07768 botrun_count = *botRLElen++;
07769 ASSERT(botrun_count == 0);
07770 }
07771
07772
07773 #ifdef UNROLL_RUN_LOOP
07774 ipixel += intermediate_width - icount;
07775 #ifdef USE_SHADOW_BUFFER
07776 shadow_pixel += shadow_width - icount;
07777 #endif
07778 #else
07779 ipixel += intermediate_width - (icount+1);
07780 #ifdef USE_SHADOW_BUFFER
07781 shadow_pixel += shadow_width - (icount+1);
07782 #endif
07783 #endif
07784
07785 Debug((vpc, VPDEBUG_COMPOSITE, "ScanDone\n"));
07786 }
07787
07788
07789
07790
07791
07792 GET_HIRES_TIME(vpc, t1);
07793 STORE_HIRES_TIME(vpc, VPTIMER_TRAVERSE_RUNS, t0, t1);
07794
07795 Debug((vpc, VPDEBUG_COMPOSITE, "SliceDone\n"));
07796 }