--- ray/src/rt/rvmain.c 2011/10/05 17:20:55 2.11 +++ ray/src/rt/rvmain.c 2023/01/24 21:54:49 2.18 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rvmain.c,v 2.11 2011/10/05 17:20:55 greg Exp $"; +static const char RCSid[] = "$Id: rvmain.c,v 2.18 2023/01/24 21:54:49 greg Exp $"; #endif /* * rvmain.c - main for rview interactive viewer @@ -18,6 +18,7 @@ static const char RCSid[] = "$Id: rvmain.c,v 2.11 2011 #include "random.h" #include "paths.h" #include "view.h" +#include "pmapray.h" extern char *progname; /* global argv[0] */ @@ -54,14 +55,13 @@ static void onsig(int signo); static void sigdie(int signo, char *msg); static void printdefaults(void); - int main(int argc, char *argv[]) { #define check(ol,al) if (argv[i][ol] || \ badarg(argc-i-1,argv+i+1,al)) \ goto badopt -#define bool(olen,var) switch (argv[i][olen]) { \ +#define check_bool(olen,var) switch (argv[i][olen]) { \ case '\0': var = !var; break; \ case 'y': case 'Y': case 't': case 'T': \ case '+': case '1': var = 1; break; \ @@ -83,7 +83,7 @@ main(int argc, char *argv[]) specthresh = .3; specjitter = 1.; maxdepth = 6; - minweight = 1e-2; + minweight = 1e-3; ambacc = 0.3; ambres = 32; ambdiv = 256; @@ -147,7 +147,7 @@ main(int argc, char *argv[]) } break; case 'b': /* grayscale */ - bool(2,greyscale); + check_bool(2,greyscale); break; case 'p': /* pixel */ switch (argv[i][2]) { @@ -171,7 +171,7 @@ main(int argc, char *argv[]) break; case 'w': /* warnings */ rval = erract[WARNING].pf != NULL; - bool(2,rval); + check_bool(2,rval); if (rval) erract[WARNING].pf = wputs; else erract[WARNING].pf = NULL; break; @@ -197,7 +197,7 @@ main(int argc, char *argv[]) /* set up signal handling */ sigdie(SIGINT, "Interrupt"); sigdie(SIGTERM, "Terminate"); -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_WIN64) sigdie(SIGHUP, "Hangup"); sigdie(SIGPIPE, "Broken pipe"); sigdie(SIGALRM, "Alarm clock"); @@ -227,12 +227,22 @@ main(int argc, char *argv[]) /* set up output & start process(es) */ SET_FILE_BINARY(stdout); - ray_init(octnm); - + ray_init(octnm); /* also calls ray_init_pmap() */ + +/* temporary shortcut, until winrview is refactored into a "device" */ +#ifndef WIN_RVIEW rview(); /* run interactive viewer */ + devclose(); /* close output device */ +#endif + /* PMAP: free photon maps */ + ray_done_pmap(); + +#ifdef WIN_RVIEW + return 1; +#endif quit(0); badopt: @@ -241,7 +251,7 @@ badopt: return 1; /* pro forma return */ #undef check -#undef bool +#undef check_bool } @@ -287,7 +297,7 @@ onsig( /* fatal signal */ if (gotsig++) /* two signals and we're gone! */ _exit(signo); -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(_WIN64) alarm(15); /* allow 15 seconds to clean up */ signal(SIGALRM, SIG_DFL); /* make certain we do die */ #endif