ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rtrace.c
(Generate patch)

Comparing ray/src/rt/rtrace.c (file contents):
Revision 2.41 by greg, Wed May 25 04:44:26 2005 UTC vs.
Revision 2.46 by greg, Fri Jun 10 20:44:00 2005 UTC

# Line 50 | Line 50 | void  (*trace)() = NULL;               /* trace call */
50  
51   char  *tralist[128];                    /* list of modifers to trace (or no) */
52   int  traincl = -1;                      /* include == 1, exclude == 0 */
53 < #define  MAXTSET        511             /* maximum number in trace set */
53 > #ifndef  MAXTSET
54 > #define  MAXTSET        1024            /* maximum number in trace set */
55 > #endif
56   OBJECT  traset[MAXTSET+1]={0};          /* trace include/exclude set */
57  
58   int  hresolu = 0;                       /* horizontal (scan) size */
# Line 74 | Line 76 | double  specjitter = 1.;               /* specular sampling jitter
76  
77   int  backvis = 1;                       /* back face visibility */
78  
79 < int  maxdepth = 8;                      /* maximum recursion depth */
79 > int  maxdepth = -10;                    /* maximum recursion depth */
80   double  minweight = 2e-3;               /* minimum ray weight */
81  
82   char  *ambfile = NULL;                  /* ambient file name */
# Line 97 | Line 99 | static putf_t puta, putd, putf;
99  
100   typedef void oputf_t(RAY *r);
101   static oputf_t  oputo, oputd, oputv, oputl, oputL, oputc, oputp,
102 <                oputn, oputN, oputs, oputw, oputW, oputm, oputM, oputdash;
102 >                oputn, oputN, oputs, oputw, oputW, oputm, oputM, oputtilde;
103  
104   static void setoutput(char *vs);
105   static void tranotify(OBJECT obj);
# Line 148 | Line 150 | rtrace(                                /* trace rays from file */
150          char  *fname
151   )
152   {
153 <        long  vcount = hresolu>1 ? hresolu*vresolu : vresolu;
153 >        unsigned long  vcount = (hresolu > 1) ? (unsigned long)hresolu*vresolu
154 >                                              : vresolu;
155          long  nextflush = hresolu;
156          FILE  *fp;
157          double  d;
# Line 160 | Line 163 | rtrace(                                /* trace rays from file */
163                  sprintf(errmsg, "cannot open input file \"%s\"", fname);
164                  error(SYSTEM, errmsg);
165          }
163 #ifdef _WIN32
166          if (inform != 'a')
167                  SET_FILE_BINARY(fp);
166 #endif
168                                          /* set up output */
169          setoutput(outvals);
170          switch (outform) {
# Line 189 | Line 190 | rtrace(                                /* trace rays from file */
190                  d = normalize(direc);
191                  if (d == 0.0) {                         /* zero ==> flush */
192                          bogusray();
193 <                        if (--nextflush <= 0 || vcount <= 0) {
193 >                        if (--nextflush <= 0 || !vcount) {
194                                  fflush(stdout);
195                                  nextflush = hresolu;
196                          }
# Line 201 | Line 202 | rtrace(                                /* trace rays from file */
202                          else
203                                  rad(orig, direc, lim_dist ? d : 0.0);
204                                                          /* flush if time */
205 <                        if (--nextflush == 0) {
205 >                        if (!--nextflush) {
206                                  fflush(stdout);
207                                  nextflush = hresolu;
208                          }
209                  }
210                  if (ferror(stdout))
211                          error(SYSTEM, "write error");
212 <                if (--vcount == 0)                      /* check for end */
212 >                if (vcount && !--vcount)                /* check for end */
213                          break;
214          }
215          fflush(stdout);
216 <        if (vcount > 0)
217 <                error(USER, "read error");
216 >        if (vcount)
217 >                error(USER, "unexpected EOF on input");
218          if (fname != NULL)
219                  fclose(fp);
220   }
# Line 240 | Line 241 | setoutput(                             /* set up output tables */
241          while (*vs)
242                  switch (*vs++) {
243                  case 'T':                               /* trace sources */
244 +                        if (!*vs) break;
245                          trace_sources();
246                          /* fall through */
247                  case 't':                               /* trace */
248 +                        if (!*vs) break;
249                          *table = NULL;
250                          table = every_out;
251                          trace = ourtrace;
# Line 296 | Line 299 | setoutput(                             /* set up output tables */
299                  case 'M':                               /* material */
300                          *table++ = oputM;
301                          break;
302 <                case '-':                               /* dash */
303 <                        *table++ = oputdash;
302 >                case '~':                               /* tilde */
303 >                        *table++ = oputtilde;
304                          break;
305                  }
306          *table = NULL;
# Line 677 | Line 680 | oputM(                         /* print material */
680  
681  
682   static void
683 < oputdash(                       /* output dash (spacer) */
683 > oputtilde(                      /* output tilde (spacer) */
684          RAY  *r
685   )
686   {
687 <        putchar('-');
685 <        putchar('\t');
687 >        fputs("~\t", stdout);
688   }
689  
690  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines