184 |
|
(flen - lastpos)/AMBVALSIZ); |
185 |
|
error(WARNING, errmsg); |
186 |
|
fseek(ambfp, lastpos, SEEK_SET); |
187 |
– |
#ifndef _WIN32 /* XXX we need a replacement for that one */ |
187 |
|
ftruncate(fileno(ambfp), (off_t)lastpos); |
189 |
– |
#endif |
188 |
|
} |
189 |
|
} else if ((ambfp = fopen(ambfile, "w+")) != NULL) { |
190 |
|
initambfile(1); /* else create new file */ |
194 |
|
sprintf(errmsg, "cannot open ambient file \"%s\"", ambfile); |
195 |
|
error(SYSTEM, errmsg); |
196 |
|
} |
199 |
– |
#ifdef getc_unlocked |
200 |
– |
flockfile(ambfp); /* application-level lock */ |
201 |
– |
#endif |
197 |
|
#ifdef F_SETLKW |
198 |
|
aflock(F_UNLCK); /* release file */ |
199 |
|
#endif |
214 |
|
lastpos = -1; |
215 |
|
} |
216 |
|
/* free ambient tree */ |
217 |
< |
unloadatree(&atrunk, &avfree); |
217 |
> |
unloadatree(&atrunk, avfree); |
218 |
|
/* reset state variables */ |
219 |
|
avsum = 0.; |
220 |
|
navsum = 0; |
666 |
|
return; |
667 |
|
|
668 |
|
/* PMAP: Otherwise factor in ambient from caustic photon map |
669 |
< |
* (ambCausticPmap() returns zero if caustic photons disabled) and |
669 |
> |
* (ambPmapCaustic() returns zero if caustic photons disabled) and |
670 |
|
* continue with RADIANCE ambient calculation */ |
671 |
|
copycolor(caustic, aval); |
672 |
|
ambPmapCaustic(caustic, r, rdepth); |
1224 |
|
oldatrunk = atrunk; |
1225 |
|
atrunk.alist = NULL; |
1226 |
|
atrunk.kid = NULL; |
1227 |
< |
unloadatree(&oldatrunk, &avinsert); |
1227 |
> |
unloadatree(&oldatrunk, avinsert); |
1228 |
|
} |
1229 |
|
} else { /* sort memory by last access time */ |
1230 |
|
/* |
1241 |
|
eputs(errmsg); |
1242 |
|
#endif |
1243 |
|
i_avlist = 0; |
1244 |
< |
unloadatree(&atrunk, &av2list); /* empty current tree */ |
1244 |
> |
unloadatree(&atrunk, av2list); /* empty current tree */ |
1245 |
|
#ifdef DEBUG |
1246 |
|
if (i_avlist < nambvals) |
1247 |
|
error(CONSISTENCY, "missing ambient values in sortambvals"); |