--- ray/src/rt/renderopts.c 2004/08/13 22:57:56 2.6 +++ ray/src/rt/renderopts.c 2016/03/21 19:06:08 2.18 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: renderopts.c,v 2.6 2004/08/13 22:57:56 greg Exp $"; +static const char RCSid[] = "$Id: renderopts.c,v 2.18 2016/03/21 19:06:08 greg Exp $"; #endif /* * renderopts.c - process common rendering options @@ -11,9 +11,10 @@ static const char RCSid[] = "$Id: renderopts.c,v 2.6 2 #include "ray.h" #include "paths.h" +#include "pmapopt.h" -extern int +int getrenderopt( /* get next render option */ int ac, char *av[] @@ -22,7 +23,7 @@ getrenderopt( /* get next render option */ #define check(ol,al) if (av[0][ol] || \ badarg(ac-1,av+1,al)) \ return(-1) -#define bool(olen,var) switch (av[0][olen]) { \ +#define check_bool(olen,var) switch (av[0][olen]) { \ case '\0': var = !var; break; \ case 'y': case 'Y': case 't': case 'T': \ case '+': case '1': var = 1; break; \ @@ -36,9 +37,12 @@ getrenderopt( /* get next render option */ return(-1); /* check if it's one we know */ switch (av[0][1]) { + case 'u': /* uncorrelated sampling */ + check_bool(2,rand_samp); + return(0); case 'b': /* back face vis. */ if (av[0][2] == 'v') { - bool(3,backvis); + check_bool(3,backvis); return(0); } break; @@ -65,7 +69,7 @@ getrenderopt( /* get next render option */ vspretest = atoi(av[1]); return(1); case 'v': /* visibility */ - bool(3,directvis); + check_bool(3,directvis); return(0); case 's': /* size */ check(3,"f"); @@ -79,7 +83,7 @@ getrenderopt( /* get next render option */ check(3,"f"); specthresh = atof(av[1]); return(1); - case 'j': /* jitter */ + case 's': /* sampling */ check(3,"f"); specjitter = atof(av[1]); return(1); @@ -98,7 +102,7 @@ getrenderopt( /* get next render option */ } break; case 'i': /* irradiance */ - bool(2,do_irrad); + check_bool(2,do_irrad); return(0); case 'a': /* ambient */ switch (av[0][2]) { @@ -140,11 +144,11 @@ getrenderopt( /* get next render option */ amblp = amblist; } if (av[0][2] == 'I') { /* file */ - rval = wordfile(amblp, + rval = wordfile(amblp, AMBLLEN-(amblp-amblist), getpath(av[1],getrlibpath(),R_OK)); if (rval < 0) { sprintf(errmsg, - "cannot open ambient include file \"%s\"", av[0]); + "cannot open ambient include file \"%s\"", av[1]); error(SYSTEM, errmsg); } amblp += rval; @@ -161,11 +165,11 @@ getrenderopt( /* get next render option */ amblp = amblist; } if (av[0][2] == 'E') { /* file */ - rval = wordfile(amblp, + rval = wordfile(amblp, AMBLLEN-(amblp-amblist), getpath(av[1],getrlibpath(),R_OK)); if (rval < 0) { sprintf(errmsg, - "cannot open ambient exclude file \"%s\"", av[0]); + "cannot open ambient exclude file \"%s\"", av[1]); error(SYSTEM, errmsg); } amblp += rval; @@ -205,18 +209,24 @@ getrenderopt( /* get next render option */ } break; } - return(-1); /* unknown option */ + + /* PMAP: Parse photon mapping options */ + return(getPmapRenderOpt(ac, av)); + +/* return(-1); */ /* unknown option */ #undef check -#undef bool +#undef check_bool } -extern void +void print_rdefaults(void) /* print default render values to stdout */ { printf(do_irrad ? "-i+\t\t\t\t# irradiance calculation on\n" : "-i-\t\t\t\t# irradiance calculation off\n"); + printf(rand_samp ? "-u+\t\t\t\t# uncorrelated Monte Carlo sampling\n" : + "-u-\t\t\t\t# correlated quasi-Monte Carlo sampling\n"); printf(backvis ? "-bv+\t\t\t\t# back face visibility on\n" : "-bv-\t\t\t\t# back face visibility off\n"); printf("-dt %f\t\t\t# direct threshold\n", shadthresh); @@ -227,7 +237,7 @@ print_rdefaults(void) /* print default render values printf("-dp %-9d\t\t\t# direct pretest density\n", vspretest); printf(directvis ? "-dv+\t\t\t\t# direct visibility on\n" : "-dv-\t\t\t\t# direct visibility off\n"); - printf("-sj %f\t\t\t# specular jitter\n", specjitter); + printf("-ss %f\t\t\t# specular sampling\n", specjitter); printf("-st %f\t\t\t# specular threshold\n", specthresh); printf("-av %f %f %f\t# ambient value\n", colval(ambval,RED), colval(ambval,GRN), colval(ambval, BLU)); @@ -245,6 +255,10 @@ print_rdefaults(void) /* print default render values colval(salbedo,GRN), colval(salbedo,BLU)); printf("-mg %f\t\t\t# mist scattering eccentricity\n", seccg); printf("-ms %f\t\t\t# mist sampling distance\n", ssampdist); - printf("-lr %-9d\t\t\t# limit reflection\n", maxdepth); - printf("-lw %f\t\t\t# limit weight\n", minweight); + printf("-lr %-9d\t\t\t# limit reflection%s\n", maxdepth, + maxdepth<=0 ? " (Russian roulette)" : ""); + printf("-lw %.2e\t\t\t# limit weight\n", minweight); + + /* PMAP: output photon map defaults */ + printPmapDefaults(); }