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

Comparing ray/src/hd/rhpict2.c (file contents):
Revision 3.6 by gwlarson, Tue Mar 9 14:23:51 1999 UTC vs.
Revision 3.7 by gwlarson, Tue Mar 9 14:48:06 1999 UTC

# Line 205 | Line 205 | int    n;
205  
206  
207   int
208 < random_samp(h, v, nl, n)        /* grow sample point noisily */
208 > random_samp(h, v, nl, n, rf)    /* grow sample point noisily */
209   int     h, v;
210   register short  nl[NNEIGH][2];
211   int     n;
212 + double  *rf;
213   {
214          float   nwt[NNEIGH];
215          int4    maxr2;
# Line 239 | Line 240 | int    n;
240                          if (r2 > maxr2) continue;
241                          if (CHK4(pixFlags, v2*hres+h2))
242                                  continue;       /* occupied */
243 <                        if (frandom() > pixWeight[r2]) {
243 <                                                /* pick neighbor instead */
243 >                        if (frandom() < *rf) {  /* pick neighbor instead */
244                                  i = random() % n;
245                                  r2 = nl[i][1]*hres + nl[i][0];
246                                  copycolor(ctmp, mypixel[r2]);
# Line 249 | Line 249 | int    n;
249                                  myweight[v2*hres+h2] += nwt[i] * myweight[r2];
250                                  continue;
251                          }
252 <                        addcolor(mypixel[v2*hres+h2], mypixel[p]);
253 <                        myweight[v2*hres+h2] += myweight[p];
252 >                        copycolor(ctmp, mypixel[p]);
253 >                        scalecolor(ctmp, pixWeight[r2]);
254 >                        addcolor(mypixel[v2*hres+h2], ctmp);
255 >                        myweight[v2*hres+h2] += pixWeight[r2] * myweight[p];
256                  }
257          }
258          return(1);
# Line 258 | Line 260 | int    n;
260  
261  
262   pixFinish(ransamp)              /* done with beams -- compute pixel values */
263 < int     ransamp;
263 > double  ransamp;
264   {
265          if (pixWeight[0] <= FTINY)
266                  init_wfunc();           /* initialize weighting function */
267          reset_flags();                  /* set occupancy flags */
268 <        meet_neighbors(kill_occl);      /* eliminate occlusion errors */
268 >        meet_neighbors(kill_occl,NULL); /* eliminate occlusion errors */
269          reset_flags();                  /* reset occupancy flags */
270 <        if (ransamp)                    /* spread samples over image */
271 <                meet_neighbors(random_samp);
270 >        if (ransamp >= 0.)              /* spread samples over image */
271 >                meet_neighbors(random_samp,&ransamp);
272          else
273 <                meet_neighbors(smooth_samp);
273 >                meet_neighbors(smooth_samp,NULL);
274          free((char *)pixFlags);         /* free pixel flags */
275          pixFlags = NULL;
276   }
# Line 345 | Line 347 | register short (*rnl)[NNEIGH];
347   }
348  
349  
350 < meet_neighbors(nf)              /* run through samples and their neighbors */
350 > meet_neighbors(nf, dp)          /* run through samples and their neighbors */
351   int     (*nf)();
352 + char    *dp;
353   {
354          short   ln[NNEIGH][2];
355          int     h, v, n, v2;
# Line 370 | Line 373 | int    (*nf)();
373                          if (!CHK4(pixFlags, v*hres+h))
374                                  continue;       /* no one home */
375                          n = findneigh(ln, h, v, rnl);
376 <                        (*nf)(h, v, ln, n);     /* call on neighbors */
376 >                        (*nf)(h, v, ln, n, dp); /* call on neighbors */
377                  }
378                  if (++v >= vres)                /* reinitialize row list */
379                          break;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines