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