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

Comparing ray/src/hd/rhdisp2.c (file contents):
Revision 3.28 by gwlarson, Thu Dec 10 10:45:55 1998 UTC vs.
Revision 3.29 by gwlarson, Fri Dec 18 11:56:10 1998 UTC

# Line 178 | Line 178 | int    n;
178   }
179  
180  
181 < int
181 > static int
182   comptodo(tdl, vw)               /* compute holodeck sections in view */
183   int     tdl[MAXTODO+1];
184   VIEW    *vw;
# Line 221 | Line 221 | VIEW   *vw;
221   }
222  
223  
224 + int
225   addview(hd, vw, hres, vres)     /* add view for section */
226   int     hd;
227   VIEW    *vw;
228   int     hres, vres;
229   {
230 <        int     sampquant;
230 >        int     sampquant, samptot = 0;
231          int     h, v, shr, svr;
232          GCOORD  gc[2];
233          FVECT   rorg, rdir;
# Line 250 | Line 251 | int    hres, vres;
251                                  continue;
252                          cbeam[getcbeam(hd,hdbindex(hdlist[hd],gc))].nr +=
253                                          sampquant;
254 +                        samptot += sampquant;
255                  }
256 +        return(samptot);
257   }
258  
259  
# Line 268 | Line 271 | int    fresh;
271   }
272  
273  
274 + int *
275   beam_view(vn, hr, vr)           /* add beam view (if advisable) */
276   VIEW    *vn;
277   int     hr, vr;
278   {
279 <        int     todo[MAXTODO+1], n;
279 >        static int      todo[MAXTODO+1];
280 >        int     n;
281          double  hdgsiz, d;
282          register HOLO   *hp;
283          register int    i;
284 +                                        /* find nearby sections */
285 +        if (!(n = comptodo(todo, vn)))
286 +                return(NULL);
287                                          /* sort our list */
288          cbeamsort(1);
289 <                                        /* add view to nearby sections */
282 <        if (!(n = comptodo(todo, vn)))
283 <                return(0);
289 >                                        /* add view to flagged sections */
290          for (i = 0; i < n; i++)
291 <                addview(todo[i], vn, hr, vr);
292 <        if (MEYERNG <= FTINY || vn->type == VT_PAR)
293 <                return(1);
291 >                if (!addview(todo[i], vn, hr, vr)) {    /* whoops! */
292 >                        register int    j;
293 >                        n--;                            /* delete from list */
294 >                        for (j = i--; j <= n; j++)
295 >                                todo[j] = todo[j+1];
296 >                }
297 >        if (!n || MEYERNG <= FTINY || vn->type == VT_PAR)
298 >                return(todo);
299          hdgsiz = 0.;                    /* compute mean grid size */
300          for (i = 0; i < n; i++) {
301                  hp = hdlist[todo[i]];
# Line 303 | Line 314 | int    hr, vr;
314                          cureye.vpt[i] = 0.5*(cureye.vpt[i] + vn->vp[i]);
315                  cureye.rng = 0.5*(cureye.rng + MEYERNG*hdgsiz + d);
316          }
317 <        return(1);
317 >        return(todo);
318   }
319  
320  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines