50 |
|
#endif |
51 |
|
#endif |
52 |
|
#ifndef SORT_INTVL |
53 |
< |
#define SORT_INTVL (SORT_THRESH*256) |
53 |
> |
#define SORT_INTVL (SORT_THRESH<<4) |
54 |
|
#endif |
55 |
|
#ifndef MAX_SORT_INTVL |
56 |
< |
#define MAX_SORT_INTVL (SORT_INTVL<<4) |
56 |
> |
#define MAX_SORT_INTVL (SORT_INTVL<<8) |
57 |
|
#endif |
58 |
|
|
59 |
|
static COLOR avsum = BLKCOLOR; /* computed ambient value sum */ |
77 |
|
#define newambval() (AMBVAL *)bmalloc(sizeof(AMBVAL)) |
78 |
|
|
79 |
|
extern long ftell(), lseek(); |
80 |
< |
static int initambfile(), avsave(), avinsert(), sortambvals(); |
80 |
> |
static int initambfile(), avsave(), avinsert(), sortambvals(), avlmemi(); |
81 |
|
static AMBVAL *avstore(); |
82 |
|
#ifdef F_SETLKW |
83 |
|
static aflock(); |
210 |
|
goto dumbamb; |
211 |
|
return; |
212 |
|
} |
213 |
< |
/* resort memory? */ |
214 |
< |
sortambvals(0); |
213 |
> |
|
214 |
> |
if (tracktime) /* sort to minimize thrashing */ |
215 |
> |
sortambvals(0); |
216 |
|
/* get ambient value */ |
217 |
|
setcolor(acol, 0.0, 0.0, 0.0); |
218 |
|
d = sumambient(acol, r, nrm, rdepth, |
258 |
|
/* do this node */ |
259 |
|
for (av = at->alist; av != NULL; av = av->next) { |
260 |
|
if (tracktime) |
261 |
< |
av->latick = ambclock++; |
261 |
> |
av->latick = ambclock; |
262 |
|
/* |
263 |
|
* Ambient level test. |
264 |
|
*/ |
617 |
|
AMBVAL tav, *tap, *pnext; |
618 |
|
register int i, j; |
619 |
|
/* see if it's time yet */ |
620 |
< |
if (!always && (ambclock < lastsort+sortintvl || |
620 |
> |
if (!always && (ambclock++ < lastsort+sortintvl || |
621 |
|
nambvals < SORT_THRESH)) |
622 |
|
return; |
623 |
|
/* |