/* * Process pixels from 'a' to 'b' inclusive. * The results are sent back all at once. * Limitation: may not do more than 'width' pixels at once, * because that is the size of the buffer (for now). */ void ph_lines(struct pkg_conn *UNUSED(pc), char *buf) { int a, b, fr; struct line_info info; struct rt_i *rtip = APP.a_rt_i; struct bu_external ext; RT_CK_RTI(rtip); if (debug > 1) fprintf(stderr, "ph_lines: %s\n", buf); if (!seen_gettrees) { bu_log("ph_lines: no MSG_GETTREES yet\n"); return; } if (!seen_matrix) { bu_log("ph_lines: no MSG_MATRIX yet\n"); return; } a=0; b=0; fr=0; if (sscanf(buf, "%d %d %d", &a, &b, &fr) != 3) bu_exit(2, "ph_lines: %s conversion error\n", buf); srv_startpix = a; /* buffer un-offset for view_pixel */ if (b-a+1 > srv_scanlen) b = a + srv_scanlen - 1; rtip->rti_nrays = 0; info.li_startpix = a; info.li_endpix = b; info.li_frame = fr; rt_prep_timer(); do_run(a, b); info.li_nrays = rtip->rti_nrays; info.li_cpusec = rt_read_timer((char *)0, 0); info.li_percent = 42.0; /* for now */ if (!bu_struct_export(&ext, (void *)&info, desc_line_info)) bu_exit(98, "ph_lines: bu_struct_export failure\n"); if (debug) { fprintf(stderr, "PIXELS fr=%d pix=%d..%d, rays=%d, cpu=%g\n", info.li_frame, info.li_startpix, info.li_endpix, info.li_nrays, info.li_cpusec); } if (pkg_2send(MSG_PIXELS, (const char *)ext.ext_buf, ext.ext_nbytes, (const char *)scanbuf, (b-a+1)*3, pcsrv) < 0) { fprintf(stderr, "MSG_PIXELS send error\n"); bu_free_external(&ext); } bu_free_external(&ext); }
void prnt_Timer(const char* eventstr) { (void) rt_read_timer(timer, TIMER_LEN-1); if (tty) { pad_Strcpy(TIMER_PTR, timer, TIMER_LEN-1); update_Screen(); } else bu_log("(%s) %s\n", eventstr == NULL ? "(null)" : eventstr, timer); return; }