1 |
greg |
1.1 |
#ifndef lint |
2 |
greg |
2.96 |
static const char RCSid[] = "$Id: rpict.c,v 2.95 2021/11/14 17:30:02 greg Exp $"; |
3 |
greg |
1.1 |
#endif |
4 |
|
|
/* |
5 |
|
|
* rpict.c - routines and variables for picture generation. |
6 |
|
|
*/ |
7 |
|
|
|
8 |
greg |
2.53 |
#include "copyright.h" |
9 |
greg |
2.52 |
|
10 |
greg |
2.32 |
#include <sys/types.h> |
11 |
|
|
|
12 |
schorsch |
2.80 |
#include "platform.h" |
13 |
|
|
#ifdef NON_POSIX |
14 |
|
|
#ifdef MINGW |
15 |
|
|
#include <sys/time.h> |
16 |
|
|
#endif |
17 |
schorsch |
2.79 |
#else |
18 |
schorsch |
2.80 |
#ifdef BSD |
19 |
|
|
#include <sys/time.h> |
20 |
|
|
#include <sys/resource.h> |
21 |
|
|
#else |
22 |
|
|
#include <sys/times.h> |
23 |
|
|
#include <unistd.h> |
24 |
|
|
#endif |
25 |
greg |
2.30 |
#endif |
26 |
greg |
1.34 |
|
27 |
schorsch |
2.55 |
#include <time.h> |
28 |
greg |
1.14 |
#include <signal.h> |
29 |
greg |
1.1 |
|
30 |
schorsch |
2.69 |
#include "ray.h" |
31 |
|
|
#include "paths.h" |
32 |
|
|
#include "ambient.h" |
33 |
greg |
1.1 |
#include "view.h" |
34 |
|
|
#include "random.h" |
35 |
schorsch |
2.55 |
#include "paths.h" |
36 |
greg |
2.87 |
#include "hilbert.h" |
37 |
greg |
2.89 |
#include "pmapbias.h" |
38 |
|
|
#include "pmapdiag.h" |
39 |
greg |
2.12 |
|
40 |
greg |
2.21 |
#define RFTEMPLATE "rfXXXXXX" |
41 |
|
|
|
42 |
greg |
2.22 |
#ifndef SIGCONT |
43 |
schorsch |
2.56 |
#ifdef SIGIO /* XXX can we live without this? */ |
44 |
greg |
2.22 |
#define SIGCONT SIGIO |
45 |
|
|
#endif |
46 |
schorsch |
2.56 |
#endif |
47 |
greg |
2.22 |
|
48 |
greg |
2.52 |
CUBE thescene; /* our scene */ |
49 |
|
|
OBJECT nsceneobjs; /* number of objects in our scene */ |
50 |
|
|
|
51 |
greg |
1.25 |
int dimlist[MAXDIM]; /* sampling dimensions */ |
52 |
|
|
int ndims = 0; /* number of sampling dimensions */ |
53 |
|
|
int samplendx; /* sample index number */ |
54 |
|
|
|
55 |
greg |
2.52 |
void (*addobjnotify[])() = {ambnotify, NULL}; |
56 |
|
|
|
57 |
greg |
1.12 |
VIEW ourview = STDVIEW; /* view parameters */ |
58 |
|
|
int hresolu = 512; /* horizontal resolution */ |
59 |
|
|
int vresolu = 512; /* vertical resolution */ |
60 |
greg |
2.14 |
double pixaspect = 1.0; /* pixel aspect ratio */ |
61 |
greg |
1.1 |
|
62 |
|
|
int psample = 4; /* pixel sample size */ |
63 |
greg |
2.14 |
double maxdiff = .05; /* max. difference for interpolation */ |
64 |
|
|
double dstrpix = 0.67; /* square pixel distribution */ |
65 |
greg |
1.1 |
|
66 |
gwlarson |
2.49 |
double mblur = 0.; /* motion blur parameter */ |
67 |
|
|
|
68 |
greg |
2.73 |
double dblur = 0.; /* depth-of-field blur parameter */ |
69 |
|
|
|
70 |
greg |
2.52 |
void (*trace)() = NULL; /* trace call */ |
71 |
|
|
|
72 |
|
|
int do_irrad = 0; /* compute irradiance? */ |
73 |
|
|
|
74 |
greg |
2.76 |
int rand_samp = 0; /* pure Monte Carlo sampling? */ |
75 |
|
|
|
76 |
greg |
2.14 |
double dstrsrc = 0.0; /* square source distribution */ |
77 |
|
|
double shadthresh = .05; /* shadow threshold */ |
78 |
|
|
double shadcert = .5; /* shadow certainty */ |
79 |
greg |
1.35 |
int directrelay = 1; /* number of source relays */ |
80 |
greg |
1.29 |
int vspretest = 512; /* virtual source pretest density */ |
81 |
greg |
2.20 |
int directvis = 1; /* sources visible? */ |
82 |
greg |
2.14 |
double srcsizerat = .25; /* maximum ratio source size/dist. */ |
83 |
greg |
2.41 |
|
84 |
|
|
COLOR cextinction = BLKCOLOR; /* global extinction coefficient */ |
85 |
greg |
2.46 |
COLOR salbedo = BLKCOLOR; /* global scattering albedo */ |
86 |
greg |
2.41 |
double seccg = 0.; /* global scattering eccentricity */ |
87 |
|
|
double ssampdist = 0.; /* scatter sampling distance */ |
88 |
greg |
1.1 |
|
89 |
greg |
2.14 |
double specthresh = .15; /* specular sampling threshold */ |
90 |
|
|
double specjitter = 1.; /* specular sampling jitter */ |
91 |
greg |
2.5 |
|
92 |
greg |
2.40 |
int backvis = 1; /* back face visibility */ |
93 |
|
|
|
94 |
greg |
2.63 |
int maxdepth = 7; /* maximum recursion depth */ |
95 |
greg |
2.84 |
double minweight = 1e-3; /* minimum ray weight */ |
96 |
greg |
1.1 |
|
97 |
greg |
2.52 |
char *ambfile = NULL; /* ambient file name */ |
98 |
greg |
1.1 |
COLOR ambval = BLKCOLOR; /* ambient value */ |
99 |
greg |
2.44 |
int ambvwt = 0; /* initial weight for ambient value */ |
100 |
greg |
2.68 |
double ambacc = 0.2; /* ambient accuracy */ |
101 |
greg |
2.63 |
int ambres = 64; /* ambient resolution */ |
102 |
|
|
int ambdiv = 512; /* ambient divisions */ |
103 |
|
|
int ambssamp = 128; /* ambient super-samples */ |
104 |
greg |
1.1 |
int ambounce = 0; /* ambient bounces */ |
105 |
greg |
2.72 |
char *amblist[AMBLLEN]; /* ambient include/exclude list */ |
106 |
greg |
1.1 |
int ambincl = -1; /* include == 1, exclude == 0 */ |
107 |
|
|
|
108 |
|
|
int ralrm = 0; /* seconds between reports */ |
109 |
|
|
|
110 |
greg |
2.14 |
double pctdone = 0.0; /* percentage done */ |
111 |
greg |
2.32 |
time_t tlastrept = 0L; /* time at last report */ |
112 |
greg |
2.52 |
time_t tstart; /* starting time */ |
113 |
greg |
1.1 |
|
114 |
greg |
2.14 |
#define MAXDIV 16 /* maximum sample size */ |
115 |
greg |
1.1 |
|
116 |
greg |
2.14 |
#define pixjitter() (.5+dstrpix*(.5-frandom())) |
117 |
greg |
1.1 |
|
118 |
greg |
2.47 |
int hres, vres; /* resolution for this frame */ |
119 |
greg |
2.8 |
|
120 |
gwlarson |
2.49 |
static VIEW lastview; /* the previous view input */ |
121 |
|
|
|
122 |
schorsch |
2.69 |
static void report(int); |
123 |
|
|
static int nextview(FILE *fp); |
124 |
|
|
static void render(char *zfile, char *oldfile); |
125 |
|
|
static void fillscanline(COLOR *scanline, float *zline, char *sd, int xres, |
126 |
|
|
int y, int xstep); |
127 |
|
|
static void fillscanbar(COLOR *scanbar[], float *zbar[], int xres, |
128 |
|
|
int y, int ysize); |
129 |
|
|
static int fillsample(COLOR *colline, float *zline, int x, int y, |
130 |
|
|
int xlen, int ylen, int b); |
131 |
|
|
static double pixvalue(COLOR col, int x, int y); |
132 |
|
|
static int salvage(char *oldfile); |
133 |
|
|
static int pixnumber(int x, int y, int xres, int yres); |
134 |
greg |
2.8 |
|
135 |
greg |
2.52 |
|
136 |
greg |
1.1 |
|
137 |
greg |
2.52 |
void |
138 |
greg |
2.94 |
quit(int code) /* quit program */ |
139 |
greg |
1.1 |
{ |
140 |
greg |
2.8 |
if (code) /* report status */ |
141 |
schorsch |
2.69 |
report(0); |
142 |
schorsch |
2.57 |
#ifndef NON_POSIX |
143 |
greg |
2.21 |
headclean(); /* delete header file */ |
144 |
|
|
pfclean(); /* clean up persist files */ |
145 |
greg |
2.52 |
#endif |
146 |
greg |
1.1 |
exit(code); |
147 |
|
|
} |
148 |
|
|
|
149 |
|
|
|
150 |
schorsch |
2.57 |
#ifndef NON_POSIX |
151 |
schorsch |
2.69 |
static void |
152 |
|
|
report(int dummy) /* report progress */ |
153 |
greg |
1.1 |
{ |
154 |
greg |
2.89 |
char bcStat [128]; |
155 |
greg |
2.88 |
double u, s; |
156 |
greg |
2.30 |
#ifdef BSD |
157 |
greg |
2.88 |
struct rusage rubuf; |
158 |
greg |
2.30 |
#else |
159 |
greg |
2.88 |
double period = 1.0 / 60.0; |
160 |
|
|
struct tms tbuf; |
161 |
greg |
2.30 |
#endif |
162 |
greg |
1.1 |
|
163 |
greg |
2.32 |
tlastrept = time((time_t *)NULL); |
164 |
greg |
2.30 |
#ifdef BSD |
165 |
greg |
1.1 |
getrusage(RUSAGE_SELF, &rubuf); |
166 |
greg |
2.88 |
u = rubuf.ru_utime.tv_sec + rubuf.ru_utime.tv_usec*1e-6; |
167 |
|
|
s = rubuf.ru_stime.tv_sec + rubuf.ru_stime.tv_usec*1e-6; |
168 |
greg |
1.1 |
getrusage(RUSAGE_CHILDREN, &rubuf); |
169 |
greg |
2.88 |
u += rubuf.ru_utime.tv_sec + rubuf.ru_utime.tv_usec*1e-6; |
170 |
|
|
s += rubuf.ru_stime.tv_sec + rubuf.ru_stime.tv_usec*1e-6; |
171 |
greg |
2.30 |
#else |
172 |
|
|
times(&tbuf); |
173 |
greg |
2.36 |
#ifdef _SC_CLK_TCK |
174 |
greg |
2.33 |
period = 1.0 / sysconf(_SC_CLK_TCK); |
175 |
greg |
2.36 |
#endif |
176 |
greg |
2.33 |
u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period; |
177 |
|
|
s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period; |
178 |
greg |
2.30 |
#endif |
179 |
greg |
1.1 |
|
180 |
greg |
2.89 |
/* PMAP: Get photon map bias compensation statistics */ |
181 |
|
|
pmapBiasCompReport(bcStat); |
182 |
|
|
|
183 |
greg |
2.30 |
sprintf(errmsg, |
184 |
rschregle |
2.90 |
"%lu rays, %s%4.2f%% after %.3fu %.3fs %.3fr hours on %s (PID %d)\n", |
185 |
greg |
2.89 |
nrays, bcStat, pctdone, u*(1./3600.), s*(1./3600.), |
186 |
greg |
2.88 |
(tlastrept-tstart)*(1./3600.), myhostname(), getpid()); |
187 |
greg |
1.24 |
eputs(errmsg); |
188 |
schorsch |
2.56 |
#ifdef SIGCONT |
189 |
greg |
2.35 |
signal(SIGCONT, report); |
190 |
|
|
#endif |
191 |
greg |
1.24 |
} |
192 |
greg |
1.1 |
#else |
193 |
schorsch |
2.69 |
static void |
194 |
schorsch |
2.71 |
report(int dummy) /* report progress */ |
195 |
greg |
1.24 |
{ |
196 |
greg |
2.89 |
char bcStat [128]; |
197 |
|
|
|
198 |
greg |
2.32 |
tlastrept = time((time_t *)NULL); |
199 |
greg |
2.89 |
|
200 |
|
|
/* PMAP: Get photon map bias compensation statistics */ |
201 |
|
|
pmapBiasCompReport(bcStat); |
202 |
|
|
|
203 |
rschregle |
2.90 |
sprintf(errmsg, "%lu rays, %s%4.2f%% after %5.4f hours\n", |
204 |
greg |
2.89 |
nrays, bcStat, pctdone, (tlastrept-tstart)/3600.0); |
205 |
greg |
1.1 |
eputs(errmsg); |
206 |
|
|
} |
207 |
greg |
1.24 |
#endif |
208 |
greg |
1.1 |
|
209 |
|
|
|
210 |
greg |
2.88 |
void |
211 |
schorsch |
2.69 |
rpict( /* generate image(s) */ |
212 |
|
|
int seq, |
213 |
|
|
char *pout, |
214 |
|
|
char *zout, |
215 |
|
|
char *prvr |
216 |
|
|
) |
217 |
greg |
2.8 |
/* |
218 |
|
|
* If seq is greater than zero, then we will render a sequence of |
219 |
|
|
* images based on view parameter strings read from the standard input. |
220 |
|
|
* If pout is NULL, then all images will be sent to the standard ouput. |
221 |
|
|
* If seq is greater than zero and prvr is an integer, then it is the |
222 |
|
|
* frame number at which rendering should begin. Preceeding view parameter |
223 |
|
|
* strings will be skipped in the input. |
224 |
|
|
* If pout and prvr are the same, prvr is renamed to avoid overwriting. |
225 |
|
|
* Note that pout and zout should contain %d format specifications for |
226 |
|
|
* sequenced file naming. |
227 |
|
|
*/ |
228 |
|
|
{ |
229 |
greg |
2.9 |
char fbuf[128], fbuf2[128]; |
230 |
greg |
2.26 |
int npicts; |
231 |
greg |
2.85 |
char *cp; |
232 |
greg |
2.14 |
RESOLU rs; |
233 |
|
|
double pa; |
234 |
greg |
2.8 |
/* check sampling */ |
235 |
|
|
if (psample < 1) |
236 |
|
|
psample = 1; |
237 |
|
|
else if (psample > MAXDIV) { |
238 |
|
|
sprintf(errmsg, "pixel sampling reduced from %d to %d", |
239 |
|
|
psample, MAXDIV); |
240 |
|
|
error(WARNING, errmsg); |
241 |
|
|
psample = MAXDIV; |
242 |
|
|
} |
243 |
|
|
/* get starting frame */ |
244 |
|
|
if (seq <= 0) |
245 |
|
|
seq = 0; |
246 |
|
|
else if (prvr != NULL && isint(prvr)) { |
247 |
greg |
2.85 |
int rn; /* skip to specified view */ |
248 |
greg |
2.8 |
if ((rn = atoi(prvr)) < seq) |
249 |
|
|
error(USER, "recover frame less than start frame"); |
250 |
|
|
if (pout == NULL) |
251 |
|
|
error(USER, "missing output file specification"); |
252 |
|
|
for ( ; seq < rn; seq++) |
253 |
|
|
if (nextview(stdin) == EOF) |
254 |
|
|
error(USER, "unexpected EOF on view input"); |
255 |
gwlarson |
2.50 |
setview(&ourview); |
256 |
greg |
2.8 |
prvr = fbuf; /* mark for renaming */ |
257 |
|
|
} |
258 |
schorsch |
2.62 |
if ((pout != NULL) & (prvr != NULL)) { |
259 |
greg |
2.8 |
sprintf(fbuf, pout, seq); |
260 |
greg |
2.18 |
if (!strcmp(prvr, fbuf)) { /* rename */ |
261 |
|
|
strcpy(fbuf2, fbuf); |
262 |
|
|
for (cp = fbuf2; *cp; cp++) |
263 |
|
|
; |
264 |
|
|
while (cp > fbuf2 && !ISDIRSEP(cp[-1])) |
265 |
|
|
cp--; |
266 |
|
|
strcpy(cp, RFTEMPLATE); |
267 |
greg |
2.8 |
prvr = mktemp(fbuf2); |
268 |
schorsch |
2.61 |
if (rename(fbuf, prvr) < 0) { |
269 |
greg |
2.28 |
if (errno == ENOENT) { /* ghost file */ |
270 |
|
|
sprintf(errmsg, |
271 |
|
|
"new output file \"%s\"", |
272 |
|
|
fbuf); |
273 |
|
|
error(WARNING, errmsg); |
274 |
|
|
prvr = NULL; |
275 |
|
|
} else { /* serious error */ |
276 |
|
|
sprintf(errmsg, |
277 |
greg |
2.8 |
"cannot rename \"%s\" to \"%s\"", |
278 |
|
|
fbuf, prvr); |
279 |
greg |
2.28 |
error(SYSTEM, errmsg); |
280 |
|
|
} |
281 |
schorsch |
2.61 |
} |
282 |
greg |
2.8 |
} |
283 |
|
|
} |
284 |
greg |
2.26 |
npicts = 0; /* render sequence */ |
285 |
greg |
2.8 |
do { |
286 |
|
|
if (seq && nextview(stdin) == EOF) |
287 |
|
|
break; |
288 |
greg |
2.25 |
pctdone = 0.0; |
289 |
greg |
2.8 |
if (pout != NULL) { |
290 |
greg |
2.93 |
int myfd; |
291 |
greg |
2.92 |
close(1); /* reassign stdout */ |
292 |
greg |
2.8 |
sprintf(fbuf, pout, seq); |
293 |
greg |
2.93 |
tryagain: |
294 |
greg |
2.92 |
errno = 0; /* exclusive open */ |
295 |
greg |
2.93 |
if ((myfd = open(fbuf, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0) { |
296 |
greg |
2.92 |
if ((errno != EEXIST) | (prvr != NULL) || |
297 |
|
|
!strcmp(fbuf, pout)) { |
298 |
greg |
2.27 |
sprintf(errmsg, |
299 |
greg |
2.92 |
"cannot open output file \"%s\"", |
300 |
greg |
2.27 |
fbuf); |
301 |
greg |
2.92 |
error(SYSTEM, errmsg); |
302 |
greg |
2.27 |
} |
303 |
gwlarson |
2.50 |
setview(&ourview); |
304 |
greg |
2.26 |
continue; /* don't clobber */ |
305 |
greg |
2.27 |
} |
306 |
greg |
2.93 |
if (myfd != 1) { |
307 |
|
|
unlink(fbuf); |
308 |
|
|
goto tryagain; /* leave it open */ |
309 |
|
|
} |
310 |
greg |
2.92 |
SET_FD_BINARY(1); |
311 |
greg |
2.8 |
dupheader(); |
312 |
|
|
} |
313 |
|
|
hres = hresolu; vres = vresolu; pa = pixaspect; |
314 |
schorsch |
2.61 |
if (prvr != NULL) { |
315 |
greg |
2.66 |
if (viewfile(prvr, &ourview, &rs) <= 0) { |
316 |
greg |
2.8 |
sprintf(errmsg, |
317 |
|
|
"cannot recover view parameters from \"%s\"", prvr); |
318 |
|
|
error(WARNING, errmsg); |
319 |
|
|
} else { |
320 |
|
|
pa = 0.0; |
321 |
|
|
hres = scanlen(&rs); |
322 |
|
|
vres = numscans(&rs); |
323 |
|
|
} |
324 |
schorsch |
2.61 |
} |
325 |
greg |
2.9 |
if ((cp = setview(&ourview)) != NULL) |
326 |
|
|
error(USER, cp); |
327 |
greg |
2.8 |
normaspect(viewaspect(&ourview), &pa, &hres, &vres); |
328 |
|
|
if (seq) { |
329 |
|
|
if (ralrm > 0) { |
330 |
greg |
2.11 |
fprintf(stderr, "FRAME %d:", seq); |
331 |
|
|
fprintview(&ourview, stderr); |
332 |
|
|
putc('\n', stderr); |
333 |
|
|
fflush(stderr); |
334 |
greg |
2.8 |
} |
335 |
|
|
printf("FRAME=%d\n", seq); |
336 |
|
|
} |
337 |
|
|
fputs(VIEWSTR, stdout); |
338 |
|
|
fprintview(&ourview, stdout); |
339 |
|
|
putchar('\n'); |
340 |
greg |
2.85 |
if ((pa < .99) | (pa > 1.01)) |
341 |
greg |
2.8 |
fputaspect(pa, stdout); |
342 |
schorsch |
2.60 |
fputnow(stdout); |
343 |
greg |
2.95 |
fputprims(stdprims, stdout); |
344 |
greg |
2.8 |
fputformat(COLRFMT, stdout); |
345 |
|
|
putchar('\n'); |
346 |
|
|
if (zout != NULL) |
347 |
greg |
2.9 |
sprintf(cp=fbuf, zout, seq); |
348 |
greg |
2.8 |
else |
349 |
greg |
2.9 |
cp = NULL; |
350 |
|
|
render(cp, prvr); |
351 |
greg |
2.8 |
prvr = NULL; |
352 |
greg |
2.26 |
npicts++; |
353 |
greg |
2.8 |
} while (seq++); |
354 |
greg |
2.26 |
/* check that we did something */ |
355 |
|
|
if (npicts == 0) |
356 |
|
|
error(WARNING, "no output produced"); |
357 |
greg |
2.8 |
} |
358 |
|
|
|
359 |
|
|
|
360 |
schorsch |
2.69 |
static int |
361 |
|
|
nextview( /* get next view from fp */ |
362 |
|
|
FILE *fp |
363 |
|
|
) |
364 |
greg |
2.8 |
{ |
365 |
greg |
2.9 |
char linebuf[256]; |
366 |
greg |
2.8 |
|
367 |
schorsch |
2.61 |
lastview = ourview; |
368 |
greg |
2.8 |
while (fgets(linebuf, sizeof(linebuf), fp) != NULL) |
369 |
greg |
2.9 |
if (isview(linebuf) && sscanview(&ourview, linebuf) > 0) |
370 |
greg |
2.8 |
return(0); |
371 |
|
|
return(EOF); |
372 |
|
|
} |
373 |
|
|
|
374 |
|
|
|
375 |
schorsch |
2.69 |
static void |
376 |
|
|
render( /* render the scene */ |
377 |
|
|
char *zfile, |
378 |
|
|
char *oldfile |
379 |
|
|
) |
380 |
greg |
1.1 |
{ |
381 |
|
|
COLOR *scanbar[MAXDIV+1]; /* scanline arrays of pixel values */ |
382 |
greg |
1.11 |
float *zbar[MAXDIV+1]; /* z values */ |
383 |
greg |
2.2 |
char *sampdens; /* previous sample density */ |
384 |
greg |
1.1 |
int ypos; /* current scanline */ |
385 |
greg |
1.15 |
int ystep; /* current y step size */ |
386 |
greg |
1.33 |
int hstep; /* h step size */ |
387 |
greg |
1.16 |
int zfd; |
388 |
greg |
1.1 |
COLOR *colptr; |
389 |
greg |
1.11 |
float *zptr; |
390 |
greg |
2.85 |
int i; |
391 |
greg |
2.52 |
/* check for empty image */ |
392 |
greg |
2.85 |
if ((hres <= 0) | (vres <= 0)) { |
393 |
greg |
2.52 |
error(WARNING, "empty output picture"); |
394 |
|
|
fprtresolu(0, 0, stdout); |
395 |
|
|
return; |
396 |
|
|
} |
397 |
greg |
1.9 |
/* allocate scanlines */ |
398 |
greg |
1.1 |
for (i = 0; i <= psample; i++) { |
399 |
greg |
2.8 |
scanbar[i] = (COLOR *)malloc(hres*sizeof(COLOR)); |
400 |
greg |
1.1 |
if (scanbar[i] == NULL) |
401 |
greg |
1.11 |
goto memerr; |
402 |
greg |
1.1 |
} |
403 |
greg |
2.2 |
hstep = (psample*140+49)/99; /* quincunx sampling */ |
404 |
|
|
ystep = (psample*99+70)/140; |
405 |
|
|
if (hstep > 2) { |
406 |
greg |
2.8 |
i = hres/hstep + 2; |
407 |
greg |
2.52 |
if ((sampdens = (char *)malloc(i)) == NULL) |
408 |
greg |
2.2 |
goto memerr; |
409 |
|
|
while (i--) |
410 |
|
|
sampdens[i] = hstep; |
411 |
|
|
} else |
412 |
|
|
sampdens = NULL; |
413 |
greg |
2.26 |
/* open z-file */ |
414 |
greg |
1.11 |
if (zfile != NULL) { |
415 |
greg |
1.16 |
if ((zfd = open(zfile, O_WRONLY|O_CREAT, 0666)) == -1) { |
416 |
greg |
2.26 |
sprintf(errmsg, "cannot open z-file \"%s\"", zfile); |
417 |
greg |
1.11 |
error(SYSTEM, errmsg); |
418 |
|
|
} |
419 |
schorsch |
2.55 |
SET_FD_BINARY(zfd); |
420 |
greg |
1.11 |
for (i = 0; i <= psample; i++) { |
421 |
greg |
2.8 |
zbar[i] = (float *)malloc(hres*sizeof(float)); |
422 |
greg |
1.11 |
if (zbar[i] == NULL) |
423 |
|
|
goto memerr; |
424 |
|
|
} |
425 |
|
|
} else { |
426 |
greg |
1.16 |
zfd = -1; |
427 |
greg |
1.11 |
for (i = 0; i <= psample; i++) |
428 |
|
|
zbar[i] = NULL; |
429 |
|
|
} |
430 |
greg |
1.1 |
/* write out boundaries */ |
431 |
greg |
2.8 |
fprtresolu(hres, vres, stdout); |
432 |
greg |
1.10 |
/* recover file and compute first */ |
433 |
greg |
1.11 |
i = salvage(oldfile); |
434 |
greg |
2.42 |
if (i >= vres) |
435 |
|
|
goto alldone; |
436 |
greg |
2.85 |
if ((zfd != -1) & (i > 0) && |
437 |
greg |
2.64 |
lseek(zfd, (off_t)i*hres*sizeof(float), SEEK_SET) < 0) |
438 |
greg |
2.26 |
error(SYSTEM, "z-file seek error in render"); |
439 |
greg |
2.8 |
pctdone = 100.0*i/vres; |
440 |
greg |
1.24 |
if (ralrm > 0) /* report init stats */ |
441 |
schorsch |
2.69 |
report(0); |
442 |
schorsch |
2.56 |
#ifdef SIGCONT |
443 |
greg |
1.32 |
else |
444 |
schorsch |
2.56 |
signal(SIGCONT, report); |
445 |
greg |
1.32 |
#endif |
446 |
greg |
2.47 |
ypos = vres-1 - i; /* initialize sampling */ |
447 |
gregl |
2.48 |
if (directvis) |
448 |
|
|
init_drawsources(psample); |
449 |
greg |
2.8 |
fillscanline(scanbar[0], zbar[0], sampdens, hres, ypos, hstep); |
450 |
greg |
1.10 |
/* compute scanlines */ |
451 |
greg |
1.15 |
for (ypos -= ystep; ypos > -ystep; ypos -= ystep) { |
452 |
|
|
/* bottom adjust? */ |
453 |
|
|
if (ypos < 0) { |
454 |
|
|
ystep += ypos; |
455 |
|
|
ypos = 0; |
456 |
|
|
} |
457 |
|
|
colptr = scanbar[ystep]; /* move base to top */ |
458 |
|
|
scanbar[ystep] = scanbar[0]; |
459 |
greg |
1.1 |
scanbar[0] = colptr; |
460 |
greg |
1.15 |
zptr = zbar[ystep]; |
461 |
|
|
zbar[ystep] = zbar[0]; |
462 |
greg |
1.11 |
zbar[0] = zptr; |
463 |
greg |
1.10 |
/* fill base line */ |
464 |
greg |
2.2 |
fillscanline(scanbar[0], zbar[0], sampdens, |
465 |
greg |
2.8 |
hres, ypos, hstep); |
466 |
greg |
1.10 |
/* fill bar */ |
467 |
greg |
2.8 |
fillscanbar(scanbar, zbar, hres, ypos, ystep); |
468 |
gregl |
2.48 |
if (directvis) /* add bitty sources */ |
469 |
|
|
drawsources(scanbar, zbar, 0, hres, ypos, ystep); |
470 |
greg |
1.10 |
/* write it out */ |
471 |
schorsch |
2.56 |
#ifdef SIGCONT |
472 |
greg |
2.22 |
signal(SIGCONT, SIG_IGN); /* don't interrupt writes */ |
473 |
greg |
1.32 |
#endif |
474 |
greg |
1.15 |
for (i = ystep; i > 0; i--) { |
475 |
greg |
1.17 |
if (zfd != -1 && write(zfd, (char *)zbar[i], |
476 |
greg |
2.8 |
hres*sizeof(float)) |
477 |
|
|
< hres*sizeof(float)) |
478 |
greg |
1.1 |
goto writerr; |
479 |
greg |
2.8 |
if (fwritescan(scanbar[i], hres, stdout) < 0) |
480 |
greg |
1.11 |
goto writerr; |
481 |
|
|
} |
482 |
greg |
1.1 |
if (fflush(stdout) == EOF) |
483 |
|
|
goto writerr; |
484 |
greg |
1.24 |
/* record progress */ |
485 |
greg |
2.8 |
pctdone = 100.0*(vres-1-ypos)/vres; |
486 |
greg |
2.32 |
if (ralrm > 0 && time((time_t *)NULL) >= tlastrept+ralrm) |
487 |
schorsch |
2.69 |
report(0); |
488 |
schorsch |
2.56 |
#ifdef SIGCONT |
489 |
greg |
1.32 |
else |
490 |
greg |
2.22 |
signal(SIGCONT, report); |
491 |
greg |
1.32 |
#endif |
492 |
greg |
1.1 |
} |
493 |
greg |
1.11 |
/* clean up */ |
494 |
schorsch |
2.56 |
#ifdef SIGCONT |
495 |
greg |
2.22 |
signal(SIGCONT, SIG_IGN); |
496 |
schorsch |
2.56 |
#endif |
497 |
greg |
2.42 |
if (zfd != -1 && write(zfd, (char *)zbar[0], hres*sizeof(float)) |
498 |
|
|
< hres*sizeof(float)) |
499 |
|
|
goto writerr; |
500 |
|
|
fwritescan(scanbar[0], hres, stdout); |
501 |
|
|
if (fflush(stdout) == EOF) |
502 |
|
|
goto writerr; |
503 |
|
|
alldone: |
504 |
greg |
1.16 |
if (zfd != -1) { |
505 |
greg |
1.20 |
if (close(zfd) == -1) |
506 |
|
|
goto writerr; |
507 |
greg |
1.11 |
for (i = 0; i <= psample; i++) |
508 |
greg |
2.52 |
free((void *)zbar[i]); |
509 |
greg |
1.11 |
} |
510 |
greg |
1.1 |
for (i = 0; i <= psample; i++) |
511 |
greg |
2.52 |
free((void *)scanbar[i]); |
512 |
greg |
2.2 |
if (sampdens != NULL) |
513 |
|
|
free(sampdens); |
514 |
greg |
1.11 |
pctdone = 100.0; |
515 |
greg |
2.13 |
if (ralrm > 0) |
516 |
schorsch |
2.69 |
report(0); |
517 |
schorsch |
2.56 |
#ifdef SIGCONT |
518 |
greg |
2.23 |
signal(SIGCONT, SIG_DFL); |
519 |
schorsch |
2.56 |
#endif |
520 |
greg |
1.1 |
return; |
521 |
|
|
writerr: |
522 |
|
|
error(SYSTEM, "write error in render"); |
523 |
greg |
1.11 |
memerr: |
524 |
|
|
error(SYSTEM, "out of memory in render"); |
525 |
greg |
1.1 |
} |
526 |
|
|
|
527 |
|
|
|
528 |
schorsch |
2.69 |
static void |
529 |
|
|
fillscanline( /* fill scan at y */ |
530 |
greg |
2.85 |
COLOR *scanline, |
531 |
|
|
float *zline, |
532 |
|
|
char *sd, |
533 |
schorsch |
2.69 |
int xres, |
534 |
|
|
int y, |
535 |
|
|
int xstep |
536 |
|
|
) |
537 |
greg |
1.1 |
{ |
538 |
greg |
1.33 |
static int nc = 0; /* number of calls */ |
539 |
greg |
2.2 |
int bl = xstep, b = xstep; |
540 |
greg |
2.14 |
double z; |
541 |
greg |
2.85 |
int i; |
542 |
greg |
2.45 |
|
543 |
greg |
1.11 |
z = pixvalue(scanline[0], 0, y); |
544 |
|
|
if (zline) zline[0] = z; |
545 |
greg |
1.33 |
/* zig-zag start for quincunx pattern */ |
546 |
greg |
2.2 |
for (i = ++nc & 1 ? xstep : xstep/2; i < xres-1+xstep; i += xstep) { |
547 |
greg |
1.15 |
if (i >= xres) { |
548 |
|
|
xstep += xres-1-i; |
549 |
|
|
i = xres-1; |
550 |
|
|
} |
551 |
greg |
1.11 |
z = pixvalue(scanline[i], i, y); |
552 |
|
|
if (zline) zline[i] = z; |
553 |
greg |
2.2 |
if (sd) b = sd[0] > sd[1] ? sd[0] : sd[1]; |
554 |
greg |
2.3 |
if (i <= xstep) |
555 |
|
|
b = fillsample(scanline, zline, 0, y, i, 0, b/2); |
556 |
|
|
else |
557 |
|
|
b = fillsample(scanline+i-xstep, |
558 |
greg |
2.38 |
zline ? zline+i-xstep : (float *)NULL, |
559 |
greg |
2.3 |
i-xstep, y, xstep, 0, b/2); |
560 |
greg |
2.2 |
if (sd) *sd++ = nc & 1 ? bl : b; |
561 |
|
|
bl = b; |
562 |
greg |
1.1 |
} |
563 |
greg |
2.2 |
if (sd && nc & 1) *sd = bl; |
564 |
greg |
1.1 |
} |
565 |
|
|
|
566 |
|
|
|
567 |
schorsch |
2.69 |
static void |
568 |
|
|
fillscanbar( /* fill interior */ |
569 |
greg |
2.85 |
COLOR *scanbar[], |
570 |
|
|
float *zbar[], |
571 |
schorsch |
2.69 |
int xres, |
572 |
|
|
int y, |
573 |
|
|
int ysize |
574 |
|
|
) |
575 |
greg |
1.1 |
{ |
576 |
|
|
COLOR vline[MAXDIV+1]; |
577 |
greg |
1.11 |
float zline[MAXDIV+1]; |
578 |
greg |
1.1 |
int b = ysize; |
579 |
greg |
2.85 |
int i, j; |
580 |
greg |
2.45 |
|
581 |
greg |
1.8 |
for (i = 0; i < xres; i++) { |
582 |
greg |
1.1 |
copycolor(vline[0], scanbar[0][i]); |
583 |
|
|
copycolor(vline[ysize], scanbar[ysize][i]); |
584 |
greg |
1.11 |
if (zbar[0]) { |
585 |
|
|
zline[0] = zbar[0][i]; |
586 |
|
|
zline[ysize] = zbar[ysize][i]; |
587 |
|
|
} |
588 |
greg |
2.38 |
b = fillsample(vline, zbar[0] ? zline : (float *)NULL, |
589 |
greg |
1.11 |
i, y, 0, ysize, b/2); |
590 |
greg |
2.45 |
|
591 |
greg |
1.1 |
for (j = 1; j < ysize; j++) |
592 |
|
|
copycolor(scanbar[j][i], vline[j]); |
593 |
greg |
1.11 |
if (zbar[0]) |
594 |
|
|
for (j = 1; j < ysize; j++) |
595 |
|
|
zbar[j][i] = zline[j]; |
596 |
greg |
1.1 |
} |
597 |
|
|
} |
598 |
|
|
|
599 |
|
|
|
600 |
schorsch |
2.69 |
static int |
601 |
|
|
fillsample( /* fill interior points */ |
602 |
greg |
2.85 |
COLOR *colline, |
603 |
|
|
float *zline, |
604 |
schorsch |
2.69 |
int x, |
605 |
|
|
int y, |
606 |
|
|
int xlen, |
607 |
|
|
int ylen, |
608 |
|
|
int b |
609 |
|
|
) |
610 |
greg |
1.1 |
{ |
611 |
greg |
2.14 |
double ratio; |
612 |
|
|
double z; |
613 |
greg |
1.1 |
COLOR ctmp; |
614 |
|
|
int ncut; |
615 |
greg |
2.85 |
int len; |
616 |
greg |
2.45 |
|
617 |
greg |
1.1 |
if (xlen > 0) /* x or y length is zero */ |
618 |
|
|
len = xlen; |
619 |
|
|
else |
620 |
|
|
len = ylen; |
621 |
greg |
2.45 |
|
622 |
greg |
1.1 |
if (len <= 1) /* limit recursion */ |
623 |
|
|
return(0); |
624 |
greg |
2.45 |
|
625 |
|
|
if (b > 0 || |
626 |
|
|
(zline && 2.*fabs(zline[0]-zline[len]) > maxdiff*(zline[0]+zline[len])) |
627 |
greg |
1.11 |
|| bigdiff(colline[0], colline[len], maxdiff)) { |
628 |
greg |
2.45 |
|
629 |
greg |
1.11 |
z = pixvalue(colline[len>>1], x + (xlen>>1), y + (ylen>>1)); |
630 |
|
|
if (zline) zline[len>>1] = z; |
631 |
greg |
1.1 |
ncut = 1; |
632 |
|
|
} else { /* interpolate */ |
633 |
|
|
copycolor(colline[len>>1], colline[len]); |
634 |
|
|
ratio = (double)(len>>1) / len; |
635 |
|
|
scalecolor(colline[len>>1], ratio); |
636 |
greg |
1.11 |
if (zline) zline[len>>1] = zline[len] * ratio; |
637 |
|
|
ratio = 1.0 - ratio; |
638 |
greg |
1.1 |
copycolor(ctmp, colline[0]); |
639 |
|
|
scalecolor(ctmp, ratio); |
640 |
|
|
addcolor(colline[len>>1], ctmp); |
641 |
greg |
1.11 |
if (zline) zline[len>>1] += zline[0] * ratio; |
642 |
greg |
1.1 |
ncut = 0; |
643 |
|
|
} |
644 |
|
|
/* recurse */ |
645 |
greg |
1.11 |
ncut += fillsample(colline, zline, x, y, xlen>>1, ylen>>1, (b-1)/2); |
646 |
greg |
2.45 |
|
647 |
greg |
2.38 |
ncut += fillsample(colline+(len>>1), |
648 |
|
|
zline ? zline+(len>>1) : (float *)NULL, |
649 |
greg |
1.11 |
x+(xlen>>1), y+(ylen>>1), |
650 |
|
|
xlen-(xlen>>1), ylen-(ylen>>1), b/2); |
651 |
greg |
1.1 |
|
652 |
|
|
return(ncut); |
653 |
|
|
} |
654 |
|
|
|
655 |
|
|
|
656 |
schorsch |
2.69 |
static double |
657 |
|
|
pixvalue( /* compute pixel value */ |
658 |
|
|
COLOR col, /* returned color */ |
659 |
|
|
int x, /* pixel position */ |
660 |
|
|
int y |
661 |
|
|
) |
662 |
greg |
1.1 |
{ |
663 |
gwlarson |
2.49 |
RAY thisray; |
664 |
|
|
FVECT lorg, ldir; |
665 |
greg |
2.73 |
double hpos, vpos, vdist, lmax; |
666 |
greg |
2.85 |
int i; |
667 |
gwlarson |
2.49 |
/* compute view ray */ |
668 |
greg |
2.85 |
setcolor(col, 0.0, 0.0, 0.0); |
669 |
gwlarson |
2.49 |
hpos = (x+pixjitter())/hres; |
670 |
|
|
vpos = (y+pixjitter())/vres; |
671 |
|
|
if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, |
672 |
greg |
2.85 |
&ourview, hpos, vpos)) < -FTINY) |
673 |
greg |
1.22 |
return(0.0); |
674 |
greg |
2.85 |
|
675 |
greg |
2.73 |
vdist = ourview.vdist; |
676 |
greg |
2.77 |
/* set pixel index */ |
677 |
|
|
samplendx = pixnumber(x,y,hres,vres); |
678 |
gwlarson |
2.49 |
/* optional motion blur */ |
679 |
|
|
if (lastview.type && mblur > FTINY && (lmax = viewray(lorg, ldir, |
680 |
|
|
&lastview, hpos, vpos)) >= -FTINY) { |
681 |
greg |
2.85 |
double d = mblur*(.5-urand(281+samplendx)); |
682 |
gwlarson |
2.49 |
|
683 |
|
|
thisray.rmax = (1.-d)*thisray.rmax + d*lmax; |
684 |
|
|
for (i = 3; i--; ) { |
685 |
|
|
thisray.rorg[i] = (1.-d)*thisray.rorg[i] + d*lorg[i]; |
686 |
|
|
thisray.rdir[i] = (1.-d)*thisray.rdir[i] + d*ldir[i]; |
687 |
|
|
} |
688 |
|
|
if (normalize(thisray.rdir) == 0.0) |
689 |
|
|
return(0.0); |
690 |
greg |
2.73 |
vdist = (1.-d)*vdist + d*lastview.vdist; |
691 |
|
|
} |
692 |
|
|
/* optional depth-of-field */ |
693 |
greg |
2.85 |
if (dblur > FTINY) { |
694 |
greg |
2.86 |
double vc, df[2]; |
695 |
|
|
/* random point on disk */ |
696 |
|
|
SDsquare2disk(df, frandom(), frandom()); |
697 |
|
|
df[0] *= .5*dblur; |
698 |
|
|
df[1] *= .5*dblur; |
699 |
greg |
2.85 |
if ((ourview.type == VT_PER) | (ourview.type == VT_PAR)) { |
700 |
|
|
double adj = 1.0; |
701 |
|
|
if (ourview.type == VT_PER) |
702 |
|
|
adj /= DOT(thisray.rdir, ourview.vdir); |
703 |
greg |
2.86 |
df[0] /= sqrt(ourview.hn2); |
704 |
|
|
df[1] /= sqrt(ourview.vn2); |
705 |
greg |
2.74 |
for (i = 3; i--; ) { |
706 |
greg |
2.85 |
vc = ourview.vp[i] + adj*vdist*thisray.rdir[i]; |
707 |
greg |
2.86 |
thisray.rorg[i] += df[0]*ourview.hvec[i] + |
708 |
|
|
df[1]*ourview.vvec[i] ; |
709 |
greg |
2.74 |
thisray.rdir[i] = vc - thisray.rorg[i]; |
710 |
|
|
} |
711 |
|
|
} else { /* non-standard view case */ |
712 |
|
|
double dfd = PI/4.*dblur*(.5 - frandom()); |
713 |
greg |
2.85 |
if ((ourview.type != VT_ANG) & (ourview.type != VT_PLS)) { |
714 |
greg |
2.74 |
if (ourview.type != VT_CYL) |
715 |
greg |
2.86 |
df[0] /= sqrt(ourview.hn2); |
716 |
|
|
df[1] /= sqrt(ourview.vn2); |
717 |
greg |
2.74 |
} |
718 |
|
|
for (i = 3; i--; ) { |
719 |
greg |
2.85 |
vc = ourview.vp[i] + vdist*thisray.rdir[i]; |
720 |
greg |
2.86 |
thisray.rorg[i] += df[0]*ourview.hvec[i] + |
721 |
|
|
df[1]*ourview.vvec[i] + |
722 |
greg |
2.74 |
dfd*ourview.vdir[i] ; |
723 |
|
|
thisray.rdir[i] = vc - thisray.rorg[i]; |
724 |
|
|
} |
725 |
greg |
2.73 |
} |
726 |
|
|
if (normalize(thisray.rdir) == 0.0) |
727 |
|
|
return(0.0); |
728 |
gwlarson |
2.49 |
} |
729 |
|
|
|
730 |
greg |
2.75 |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
731 |
greg |
1.25 |
|
732 |
greg |
1.1 |
rayvalue(&thisray); /* trace ray */ |
733 |
|
|
|
734 |
|
|
copycolor(col, thisray.rcol); /* return color */ |
735 |
greg |
2.45 |
|
736 |
greg |
2.91 |
return(raydistance(&thisray)); /* return distance */ |
737 |
greg |
1.1 |
} |
738 |
|
|
|
739 |
|
|
|
740 |
schorsch |
2.69 |
static int |
741 |
|
|
salvage( /* salvage scanlines from killed program */ |
742 |
|
|
char *oldfile |
743 |
|
|
) |
744 |
greg |
1.1 |
{ |
745 |
|
|
COLR *scanline; |
746 |
|
|
FILE *fp; |
747 |
|
|
int x, y; |
748 |
|
|
|
749 |
|
|
if (oldfile == NULL) |
750 |
greg |
2.37 |
goto gotzip; |
751 |
|
|
|
752 |
greg |
1.9 |
if ((fp = fopen(oldfile, "r")) == NULL) { |
753 |
greg |
1.1 |
sprintf(errmsg, "cannot open recover file \"%s\"", oldfile); |
754 |
|
|
error(WARNING, errmsg); |
755 |
greg |
2.37 |
goto gotzip; |
756 |
greg |
1.1 |
} |
757 |
schorsch |
2.55 |
SET_FILE_BINARY(fp); |
758 |
greg |
1.1 |
/* discard header */ |
759 |
greg |
2.19 |
getheader(fp, NULL, NULL); |
760 |
greg |
1.1 |
/* get picture size */ |
761 |
greg |
1.36 |
if (!fscnresolu(&x, &y, fp)) { |
762 |
greg |
2.29 |
sprintf(errmsg, "bad recover file \"%s\" - not removed", |
763 |
|
|
oldfile); |
764 |
greg |
1.2 |
error(WARNING, errmsg); |
765 |
greg |
1.1 |
fclose(fp); |
766 |
greg |
2.37 |
goto gotzip; |
767 |
greg |
1.1 |
} |
768 |
|
|
|
769 |
greg |
2.85 |
if ((x != hres) | (y != vres)) { |
770 |
greg |
1.1 |
sprintf(errmsg, "resolution mismatch in recover file \"%s\"", |
771 |
|
|
oldfile); |
772 |
|
|
error(USER, errmsg); |
773 |
|
|
} |
774 |
|
|
|
775 |
greg |
2.8 |
scanline = (COLR *)malloc(hres*sizeof(COLR)); |
776 |
greg |
1.1 |
if (scanline == NULL) |
777 |
|
|
error(SYSTEM, "out of memory in salvage"); |
778 |
greg |
2.8 |
for (y = 0; y < vres; y++) { |
779 |
|
|
if (freadcolrs(scanline, hres, fp) < 0) |
780 |
greg |
1.1 |
break; |
781 |
greg |
2.8 |
if (fwritecolrs(scanline, hres, stdout) < 0) |
782 |
greg |
1.1 |
goto writerr; |
783 |
|
|
} |
784 |
|
|
if (fflush(stdout) == EOF) |
785 |
|
|
goto writerr; |
786 |
greg |
2.52 |
free((void *)scanline); |
787 |
greg |
1.1 |
fclose(fp); |
788 |
|
|
unlink(oldfile); |
789 |
|
|
return(y); |
790 |
greg |
2.37 |
gotzip: |
791 |
|
|
if (fflush(stdout) == EOF) |
792 |
|
|
error(SYSTEM, "error writing picture header"); |
793 |
|
|
return(0); |
794 |
greg |
1.1 |
writerr: |
795 |
greg |
2.9 |
sprintf(errmsg, "write error during recovery of \"%s\"", oldfile); |
796 |
|
|
error(SYSTEM, errmsg); |
797 |
schorsch |
2.69 |
return -1; /* pro forma return */ |
798 |
greg |
1.31 |
} |
799 |
|
|
|
800 |
schorsch |
2.69 |
static int |
801 |
greg |
2.87 |
pixnumber( /* compute pixel index (screen door) */ |
802 |
greg |
2.85 |
int x, |
803 |
|
|
int y, |
804 |
schorsch |
2.69 |
int xres, |
805 |
|
|
int yres |
806 |
|
|
) |
807 |
greg |
1.31 |
{ |
808 |
greg |
2.87 |
unsigned nbits = 0; |
809 |
|
|
bitmask_t coord[2]; |
810 |
|
|
|
811 |
|
|
if (xres < yres) xres = yres; |
812 |
|
|
while (xres > 0) { |
813 |
|
|
xres >>= 1; |
814 |
|
|
++nbits; |
815 |
|
|
} |
816 |
|
|
coord[0] = x; coord[1] = y; |
817 |
|
|
return ((int)hilbert_c2i(2, nbits, coord)); |
818 |
greg |
1.1 |
} |