--- ray/src/rt/rtrace.c 2005/05/26 06:55:22 2.42 +++ ray/src/rt/rtrace.c 2005/06/10 16:49:42 2.45 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rtrace.c,v 2.42 2005/05/26 06:55:22 greg Exp $"; +static const char RCSid[] = "$Id: rtrace.c,v 2.45 2005/06/10 16:49:42 greg Exp $"; #endif /* * rtrace.c - program and variables for individual ray tracing. @@ -74,7 +74,7 @@ double specjitter = 1.; /* specular sampling jitter int backvis = 1; /* back face visibility */ -int maxdepth = 8; /* maximum recursion depth */ +int maxdepth = -10; /* maximum recursion depth */ double minweight = 2e-3; /* minimum ray weight */ char *ambfile = NULL; /* ambient file name */ @@ -148,7 +148,8 @@ rtrace( /* trace rays from file */ char *fname ) { - long vcount = hresolu>1 ? hresolu*vresolu : vresolu; + unsigned long vcount = (hresolu > 1) ? (unsigned long)hresolu*vresolu + : vresolu; long nextflush = hresolu; FILE *fp; double d; @@ -160,10 +161,8 @@ rtrace( /* trace rays from file */ sprintf(errmsg, "cannot open input file \"%s\"", fname); error(SYSTEM, errmsg); } -#ifdef _WIN32 if (inform != 'a') SET_FILE_BINARY(fp); -#endif /* set up output */ setoutput(outvals); switch (outform) { @@ -189,7 +188,7 @@ rtrace( /* trace rays from file */ d = normalize(direc); if (d == 0.0) { /* zero ==> flush */ bogusray(); - if (--nextflush <= 0 || vcount <= 0) { + if (--nextflush <= 0 || !vcount) { fflush(stdout); nextflush = hresolu; } @@ -201,18 +200,18 @@ rtrace( /* trace rays from file */ else rad(orig, direc, lim_dist ? d : 0.0); /* flush if time */ - if (--nextflush == 0) { + if (!--nextflush) { fflush(stdout); nextflush = hresolu; } } if (ferror(stdout)) error(SYSTEM, "write error"); - if (--vcount == 0) /* check for end */ + if (vcount && !--vcount) /* check for end */ break; } fflush(stdout); - if (vcount > 0) + if (vcount) error(USER, "unexpected EOF on input"); if (fname != NULL) fclose(fp);