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.21 by greg, Thu Aug 5 16:25:05 1993 UTC vs.
Revision 2.24 by greg, Thu Mar 24 13:41:04 1994 UTC

# Line 214 | Line 214 | double s;
214                  /*
215                   *  Ambient level test.
216                   */
217 <                if (av->lvl > al || av->weight < r->rweight-FTINY)
217 >                if (av->lvl > al)       /* list sorted, so this works */
218 >                        break;
219 >                if (av->weight < r->rweight-FTINY)
220                          continue;
221                  /*
222                   *  Ambient radius test.
# Line 349 | Line 351 | int  creat;
351   #endif
352          setbuf(ambfp, bmalloc(BUFSIZ+8));
353          if (creat) {                    /* new file */
354 +                newheader("RADIANCE", ambfp);
355                  fprintf(ambfp, "%s -av %g %g %g -ab %d -aa %g ",
356                                  progname, colval(ambval,RED),
357                                  colval(ambval,GRN), colval(ambval,BLU),
# Line 401 | Line 404 | avinsert(av)                           /* insert ambient value in our tree */
404   register AMBVAL  *av;
405   {
406          register AMBTREE  *at;
407 +        register AMBVAL  *ap;
408 +        AMBVAL  avh;
409          FVECT  ck0;
410          double  s;
411          int  branch;
# Line 424 | Line 429 | register AMBVAL         *av;
429                          }
430                  at = at->kid + branch;
431          }
432 <        av->next = at->alist;
433 <        at->alist = av;
432 >        avh.next = at->alist;           /* order by increasing level */
433 >        for (ap = &avh; ap->next != NULL; ap = ap->next)
434 >                if (ap->next->lvl >= av->lvl)
435 >                        break;
436 >        av->next = ap->next;
437 >        ap->next = av;
438 >        at->alist = avh.next;
439   }
440  
441  
# Line 493 | Line 503 | ambsync()                      /* synchronize ambient file */
503                          avinsert(avstore(&avs));
504                          n -= AMBVALSIZ;
505                  }
506 <                if (n)                          /* alignment */
506 >                /*** seek always as safety measure
507 >                if (n) ***/                     /* alignment */
508                          if (lseek(fileno(ambfp), flen-n, 0) < 0)
509                                  goto seekerr;
510          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines