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.26 by gwlarson, Tue Nov 24 17:05:36 1998 UTC vs.
Revision 3.29 by gwlarson, Fri Dec 18 11:56:10 1998 UTC

# Line 17 | Line 17 | static char SCCSid[] = "$SunId$ SGI";
17   #define MAXDIST         42      /* maximum distance outside section */
18   #endif
19   #ifndef NVSAMPS
20 < #define NVSAMPS         4096    /* number of ray samples per view */
20 > #define NVSAMPS         16384   /* number of ray samples per view */
21   #endif
22   #ifndef MEYERNG
23 < #define MEYERNG         0.2     /* target mean eye range (rel. to grid) */
23 > #define MEYERNG         0.1     /* target mean eye range (rel. to grid) */
24   #endif
25   #ifndef MAXTODO
26   #define MAXTODO         3       /* maximum sections to look at */
# 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);
294 <        hdgsiz = 0.; d = 1./3. / n;     /* compute mean grid size */
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]];
302 <                hdgsiz += d * ( VLEN(hp->xv[0])/hp->grid[0] +
303 <                                VLEN(hp->xv[1])/hp->grid[1] +
304 <                                VLEN(hp->xv[2])/hp->grid[2] ) ;
302 >                hdgsiz +=       1./3. / VLEN(hp->wg[0]) +
303 >                                1./3. / VLEN(hp->wg[1]) +
304 >                                1./3. / VLEN(hp->wg[2]) ;
305          }
306 +        hdgsiz /= (double)n;
307                                          /* add to current eye position */
308          if (cureye.rng <= FTINY) {
309                  VCOPY(cureye.vpt, vn->vp);
# Line 302 | 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