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

Comparing ray/src/rt/ambient.c (file contents):
Revision 2.22 by greg, Fri Aug 6 17:24:24 1993 UTC vs.
Revision 2.25 by greg, Thu Jun 2 11:45:27 1994 UTC

# Line 59 | Line 59 | int  ar;
59          ambres = ar < 0 ? 0 : ar;               /* may be done already */
60                                                  /* set min & max radii */
61          if (ar <= 0) {
62 <                minarad = 0.0;
62 >                minarad = 0;
63                  maxarad = thescene.cusize / 2.0;
64          } else {
65                  minarad = thescene.cusize / ar;
66 <                maxarad = 16.0 * minarad;               /* heuristic */
66 >                maxarad = 16 * minarad;                 /* heuristic */
67                  if (maxarad > thescene.cusize / 2.0)
68                          maxarad = thescene.cusize / 2.0;
69          }
70 <        if (maxarad <= FTINY)
71 <                maxarad = .001;
70 >        if (minarad <= FTINY)
71 >                minarad = 10*FTINY;
72 >        if (maxarad <= minarad)
73 >                maxarad = 64 * minarad;
74   }
75  
76  
# Line 214 | Line 216 | double s;
216                  /*
217                   *  Ambient level test.
218                   */
219 <                if (av->lvl > al || av->weight < r->rweight-FTINY)
219 >                if (av->lvl > al)       /* list sorted, so this works */
220 >                        break;
221 >                if (av->weight < r->rweight-FTINY)
222                          continue;
223                  /*
224                   *  Ambient radius test.
# Line 349 | Line 353 | int  creat;
353   #endif
354          setbuf(ambfp, bmalloc(BUFSIZ+8));
355          if (creat) {                    /* new file */
356 +                newheader("RADIANCE", ambfp);
357                  fprintf(ambfp, "%s -av %g %g %g -ab %d -aa %g ",
358                                  progname, colval(ambval,RED),
359                                  colval(ambval,GRN), colval(ambval,BLU),
# Line 401 | Line 406 | avinsert(av)                           /* insert ambient value in our tree */
406   register AMBVAL  *av;
407   {
408          register AMBTREE  *at;
409 +        register AMBVAL  *ap;
410 +        AMBVAL  avh;
411          FVECT  ck0;
412          double  s;
413          int  branch;
# Line 424 | Line 431 | register AMBVAL         *av;
431                          }
432                  at = at->kid + branch;
433          }
434 <        av->next = at->alist;
435 <        at->alist = av;
434 >        avh.next = at->alist;           /* order by increasing level */
435 >        for (ap = &avh; ap->next != NULL; ap = ap->next)
436 >                if (ap->next->lvl >= av->lvl)
437 >                        break;
438 >        av->next = ap->next;
439 >        ap->next = av;
440 >        at->alist = avh.next;
441   }
442  
443  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines