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

Comparing ray/src/hd/rholo2.c (file contents):
Revision 3.5 by gregl, Fri Dec 12 18:23:09 1997 UTC vs.
Revision 3.10 by gregl, Thu Dec 18 09:33:35 1997 UTC

# Line 34 | Line 34 | register PACKET        *p;
34                  p->ra[i].r[1][0] = sl[2] * 256.;
35                  p->ra[i].r[1][1] = sl[3] * 256.;
36                  d = hdray(ro, rd, hdlist[p->hd], gc, p->ra[i].r);
37 +                if (!vdef(OBSTRUCTIONS))
38 +                        d *= frandom();                 /* random offset */
39                  if (p->offset != NULL) {
40 <                        VSUM(ro, ro, rd, d);            /* exterior only */
40 >                        VSUM(ro, ro, rd, d);            /* advance ray */
41                          p->offset[i] = d;
42                  }
43                  VCOPY(rod, ro);
# Line 72 | Line 74 | done_rtrace()                  /* clean up and close rtrace calculati
74                                          /* already closed? */
75          if (!nprocs)
76                  return;
75                                        /* report activity */
76        wputs("closing rtrace process...\n");
77                                          /* flush beam queue */
78          done_packets(flush_queue());
79 +                                        /* sync holodeck */
80 +        hdsync(NULL, 1);
81                                          /* close rtrace */
82          if ((status = end_rtrace()))
83                  error(WARNING, "bad exit status from rtrace");
84 <        if (vdef(REPORT))               /* report time */
84 >        if (vdef(REPORT)) {             /* report time */
85 >                eputs("rtrace process closed\n");
86                  report(0);
87 +        }
88          return(status);                 /* return status */
89   }
90  
# Line 91 | Line 95 | new_rtrace()                   /* restart rtrace calculation */
95  
96          if (nprocs > 0)                 /* already running? */
97                  return;
98 <        wputs("restarting rtrace process...\n");
98 >        starttime = time(NULL);         /* reset start time and counts */
99 >        npacksdone = nraysdone = 0L;
100 >        if (vdef(TIME))                 /* reset end time */
101 >                endtime = starttime + vflt(TIME)*3600. + .5;
102          if (vdef(RIF)) {                /* rerun rad to update octree */
103                  sprintf(combuf, "rad -v 0 -s -w %s", vval(RIF));
104                  if (system(combuf))
# Line 99 | Line 106 | new_rtrace()                   /* restart rtrace calculation */
106          }
107          if (start_rtrace() < 1)         /* start rtrace */
108                  error(WARNING, "cannot restart rtrace");
109 <        else if (vdef(REPORT))
109 >        else if (vdef(REPORT)) {
110 >                eputs("rtrace process restarted\n");
111                  report(0);
112 +        }
113   }
114  
115  
# Line 141 | Line 150 | getradfile()                   /* run rad and get needed variables */
150          if (system(combuf)) {
151                  unlink(tf2);                    /* clean up */
152                  unlink(tf1);
153 <                error(SYSTEM, "cannot execute rad command");
153 >                error(USER, "error executing rad command");
154          }
155          if (pippt == NULL) {
156                  loadvars(tf2);                  /* load variables */
# Line 149 | Line 158 | getradfile()                   /* run rad and get needed variables */
158          }
159          rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */
160          unlink(tf1);                    /* clean up */
161 + }
162 +
163 +
164 + report(t)                       /* report progress so far */
165 + time_t  t;
166 + {
167 +        static time_t   seconds2go = 1000000;
168 +
169 +        if (t == 0L)
170 +                t = time(NULL);
171 +        sprintf(errmsg, "%ld packets (%ld rays) done after %.2f hours\n",
172 +                        npacksdone, nraysdone, (t-starttime)/3600.);
173 +        eputs(errmsg);
174 +        if (seconds2go == 1000000)
175 +                seconds2go = vdef(REPORT) ? (long)(vflt(REPORT)*60. + .5) : 0L;
176 +        if (seconds2go)
177 +                reporttime = t + seconds2go;
178   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines