Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* PREAMBLE */
- InitialPart.pt_forw = InitialPart.pt_back = &InitialPart;
- BU_LIST_INIT(&waiting_segs.l);
- if (BU_LIST_IS_EMPTY(&resp->re_region_ptbl)) {
- BU_ALLOC(regionbits, struct bu_ptbl);
- bu_ptbl_init(regionbits, 7, "rt_shootray() regionbits ptbl");
- } else {
- regionbits = BU_LIST_FIRST(bu_ptbl, &resp->re_region_ptbl);
- BU_LIST_DEQUEUE(®ionbits->l);
- BU_CK_PTBL(regionbits);
- }
- /* ...traverse... */
- BU_LIST_INIT(&new_segs.l);
- /* ...shot... */
- /* new_segs contains the results segments for one solid */
- struct seg *s2;
- while (BU_LIST_WHILE(s2, seg, &(new_segs.l))) {
- BU_LIST_DEQUEUE(&(s2->l));
- /* Restore to original distance */
- s2->seg_in.hit_dist += ss.dist_corr;
- s2->seg_out.hit_dist += ss.dist_corr;
- s2->seg_in.hit_rayp = s2->seg_out.hit_rayp = a_ray;
- BU_LIST_INSERT(&(waiting_segs.l), &(s2->l));
- }
- /* waiting_segs contains the results segments for cell(s) */
- if (BU_LIST_NON_EMPTY(&(waiting_segs.l))) {
- rt_boolweave(pfinished_segs, &waiting_segs, &InitialPart, ap);
- }
- /* finished_segs chain now has all segments hit by this ray */
- if (BU_LIST_IS_EMPTY(&(pfinished_segs->l))) {
- ap->a_return = 0;
- goto out;
- }
- /*
- * All intersections of the ray with the model have been computed.
- * Evaluate the boolean trees over each partition.
- */
- /* Evaluate regions up to end of good segs */
- (void)rt_boolfinal(&InitialPart, pFinalPart, BACKING_DIST, INFINITY, regionbits, ap, solidbits);
- if (pFinalPart->pt_forw == pFinalPart) {
- ap->a_return = 0;
- RT_FREE_PT_LIST(&InitialPart, resp);
- goto out;
- }
- /*
- * Before recursing, release storage for unused Initial
- * partitions. finished_segs can not be released yet, because
- * FinalPart partitions will point to hits in those segments.
- */
- RT_FREE_PT_LIST(&InitialPart, resp);
- /*
- * finished_segs is only used by special hit routines which don't
- * follow the traditional solid modeling paradigm.
- */
- ap->a_return = 1;
- /*
- * Processing of this ray is complete.
- */
- out:
- /* Terminate any logging */
- return ap->a_return;
Advertisement
Add Comment
Please, Sign In to add comment