--- ray/src/cv/bsdf2ttree.c 2014/08/21 10:33:48 2.29 +++ ray/src/cv/bsdf2ttree.c 2016/02/02 18:08:32 2.33 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.29 2014/08/21 10:33:48 greg Exp $"; +static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.33 2016/02/02 18:08:32 greg Exp $"; #endif /* * Load measured BSDF interpolant and write out as XML file with tensor tree. @@ -19,9 +19,9 @@ static const char RCSid[] = "$Id: bsdf2ttree.c,v 2.29 /* global argv[0] */ char *progname; /* percentage to cull (<0 to turn off) */ -double pctcull = 90.; +static double pctcull = 90.; /* sampling order */ -int samp_order = 6; +static int samp_order = 6; /* super-sampling threshold */ const double ssamp_thresh = 0.35; /* number of super-samples */ @@ -41,18 +41,21 @@ static int do_prog = 79; static void prog_show(double frac) { - char pbar[256]; - int nchars; + static unsigned call_cnt = 0; + static char lastc[] = "-\\|/"; + char pbar[256]; + int nchars; - if (do_prog <= 0) return; + if (do_prog <= 1) return; if (do_prog > sizeof(pbar)-2) do_prog = sizeof(pbar)-2; if (frac < 0) frac = 0; - else if (frac > 1) frac = 1; - nchars = do_prog*frac + .5; + else if (frac >= 1) frac = .9999; + nchars = do_prog*frac; pbar[0] = '\r'; memset(pbar+1, '*', nchars); - memset(pbar+1+nchars, '-', do_prog-nchars); + pbar[nchars+1] = lastc[call_cnt++ & 3]; + memset(pbar+2+nchars, '-', do_prog-nchars-1); pbar[do_prog+1] = '\0'; fputs(pbar, stderr); }