1 |
– |
/* Copyright (c) 1996 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Radiance animation control program |
6 |
+ |
* |
7 |
+ |
* The main difference between this program and ranimove is that |
8 |
+ |
* we have many optimizations here for camera motion in static |
9 |
+ |
* environments, calling rpict and pinterp on multiple processors, |
10 |
+ |
* where ranimove puts its emphasis on object motion, and does |
11 |
+ |
* not use any external programs for image generation. |
12 |
+ |
* |
13 |
+ |
* See the ranimate(1) man page for further details. |
14 |
|
*/ |
15 |
|
|
16 |
< |
#include "standard.h" |
16 |
> |
#include "copyright.h" |
17 |
> |
|
18 |
> |
#include <stdio.h> |
19 |
|
#include <ctype.h> |
13 |
– |
#include <sys/types.h> |
20 |
|
#include <sys/stat.h> |
21 |
+ |
#include <time.h> |
22 |
+ |
#include <signal.h> |
23 |
+ |
|
24 |
+ |
#include "platform.h" |
25 |
+ |
#include "rtprocess.h" |
26 |
+ |
#include "paths.h" |
27 |
+ |
#include "standard.h" |
28 |
|
#include "view.h" |
29 |
|
#include "vars.h" |
30 |
|
#include "netproc.h" |
31 |
+ |
/* default blur samples */ |
32 |
+ |
#ifndef DEF_NBLUR |
33 |
+ |
#define DEF_NBLUR 5 |
34 |
+ |
#endif |
35 |
|
/* default remote shell */ |
36 |
< |
#ifdef _AUX_SOURCE |
37 |
< |
#define REMSH "remsh" |
21 |
< |
#else |
22 |
< |
#define REMSH "rsh" |
36 |
> |
#ifndef REMSH |
37 |
> |
#define REMSH "ssh" |
38 |
|
#endif |
39 |
< |
/* input variables */ |
40 |
< |
#define HOST 0 /* rendering host machine */ |
41 |
< |
#define RENDER 1 /* rendering options */ |
42 |
< |
#define PFILT 2 /* pfilt options */ |
43 |
< |
#define PINTERP 3 /* pinterp options */ |
44 |
< |
#define OCTREE 4 /* octree file name */ |
45 |
< |
#define DIRECTORY 5 /* working (sub)directory */ |
46 |
< |
#define BASENAME 6 /* output image base name */ |
47 |
< |
#define VIEWFILE 7 /* animation frame views */ |
48 |
< |
#define START 8 /* starting frame number */ |
49 |
< |
#define END 9 /* ending frame number */ |
50 |
< |
#define RIF 10 /* rad input file */ |
39 |
> |
/* input variables (alphabetical by name) */ |
40 |
> |
#define ANIMATE 0 /* animation command */ |
41 |
> |
#define ARCHIVE 1 /* archiving command */ |
42 |
> |
#define BASENAME 2 /* output image base name */ |
43 |
> |
#define DBLUR 3 /* depth of field blur */ |
44 |
> |
#define DIRECTORY 4 /* working (sub)directory */ |
45 |
> |
#define DISKSPACE 5 /* how much disk space to use */ |
46 |
> |
#define END 6 /* ending frame number */ |
47 |
> |
#define EXPOSURE 7 /* how to compute exposure */ |
48 |
> |
#define HOST 8 /* rendering host machine */ |
49 |
> |
#define INTERP 9 /* # frames to interpolate */ |
50 |
> |
#define MBLUR 10 /* motion blur parameters */ |
51 |
|
#define NEXTANIM 11 /* next animation file */ |
52 |
< |
#define ANIMATE 12 /* animation command */ |
53 |
< |
#define TRANSFER 13 /* frame transfer command */ |
54 |
< |
#define ARCHIVE 14 /* archiving command */ |
55 |
< |
#define INTERP 15 /* # frames to interpolate */ |
56 |
< |
#define OVERSAMP 16 /* # times to oversample image */ |
57 |
< |
#define MBLUR 17 /* samples for motion blur */ |
58 |
< |
#define RTRACE 18 /* use rtrace with pinterp? */ |
59 |
< |
#define DISKSPACE 19 /* how much disk space to use */ |
60 |
< |
#define RESOLUTION 20 /* desired final resolution */ |
61 |
< |
#define EXPOSURE 21 /* how to compute exposure */ |
62 |
< |
#define RSH 22 /* remote shell script or program */ |
52 |
> |
#define OCTREE 12 /* octree file name */ |
53 |
> |
#define OVERSAMP 13 /* # times to oversample image */ |
54 |
> |
#define PFILT 14 /* pfilt options */ |
55 |
> |
#define PINTERP 15 /* pinterp options */ |
56 |
> |
#define RENDER 16 /* rendering options */ |
57 |
> |
#define RESOLUTION 17 /* desired final resolution */ |
58 |
> |
#define RIF 18 /* rad input file */ |
59 |
> |
#define RSH 19 /* remote shell script or program */ |
60 |
> |
#define RTRACE 20 /* use rtrace with pinterp? */ |
61 |
> |
#define START 21 /* starting frame number */ |
62 |
> |
#define TRANSFER 22 /* frame transfer command */ |
63 |
> |
#define VIEWFILE 23 /* animation frame views */ |
64 |
|
|
65 |
< |
int NVARS = 23; /* total number of variables */ |
65 |
> |
int NVARS = 24; /* total number of variables */ |
66 |
|
|
67 |
|
VARIABLE vv[] = { /* variable-value pairs */ |
52 |
– |
{"host", 4, 0, NULL, NULL}, |
53 |
– |
{"render", 3, 0, NULL, catvalues}, |
54 |
– |
{"pfilt", 2, 0, NULL, catvalues}, |
55 |
– |
{"pinterp", 2, 0, NULL, catvalues}, |
56 |
– |
{"OCTREE", 3, 0, NULL, onevalue}, |
57 |
– |
{"DIRECTORY", 3, 0, NULL, onevalue}, |
58 |
– |
{"BASENAME", 3, 0, NULL, onevalue}, |
59 |
– |
{"VIEWFILE", 2, 0, NULL, onevalue}, |
60 |
– |
{"START", 2, 0, NULL, intvalue}, |
61 |
– |
{"END", 2, 0, NULL, intvalue}, |
62 |
– |
{"RIF", 3, 0, NULL, onevalue}, |
63 |
– |
{"NEXTANIM", 3, 0, NULL, onevalue}, |
68 |
|
{"ANIMATE", 2, 0, NULL, onevalue}, |
65 |
– |
{"TRANSFER", 2, 0, NULL, onevalue}, |
69 |
|
{"ARCHIVE", 2, 0, NULL, onevalue}, |
70 |
+ |
{"BASENAME", 3, 0, NULL, onevalue}, |
71 |
+ |
{"DBLUR", 2, 0, NULL, onevalue}, |
72 |
+ |
{"DIRECTORY", 3, 0, NULL, onevalue}, |
73 |
+ |
{"DISKSPACE", 3, 0, NULL, fltvalue}, |
74 |
+ |
{"END", 2, 0, NULL, intvalue}, |
75 |
+ |
{"EXPOSURE", 3, 0, NULL, onevalue}, |
76 |
+ |
{"host", 4, 0, NULL, NULL}, |
77 |
|
{"INTERPOLATE", 3, 0, NULL, intvalue}, |
68 |
– |
{"OVERSAMPLE", 2, 0, NULL, fltvalue}, |
78 |
|
{"MBLUR", 2, 0, NULL, onevalue}, |
79 |
< |
{"RTRACE", 2, 0, NULL, boolvalue}, |
80 |
< |
{"DISKSPACE", 3, 0, NULL, fltvalue}, |
79 |
> |
{"NEXTANIM", 3, 0, NULL, onevalue}, |
80 |
> |
{"OCTREE", 3, 0, NULL, onevalue}, |
81 |
> |
{"OVERSAMPLE", 2, 0, NULL, fltvalue}, |
82 |
> |
{"pfilt", 2, 0, NULL, catvalues}, |
83 |
> |
{"pinterp", 2, 0, NULL, catvalues}, |
84 |
> |
{"render", 3, 0, NULL, catvalues}, |
85 |
|
{"RESOLUTION", 3, 0, NULL, onevalue}, |
86 |
< |
{"EXPOSURE", 3, 0, NULL, onevalue}, |
86 |
> |
{"RIF", 3, 0, NULL, onevalue}, |
87 |
|
{"RSH", 3, 0, NULL, onevalue}, |
88 |
+ |
{"RTRACE", 2, 0, NULL, boolvalue}, |
89 |
+ |
{"START", 2, 0, NULL, intvalue}, |
90 |
+ |
{"TRANSFER", 2, 0, NULL, onevalue}, |
91 |
+ |
{"VIEWFILE", 2, 0, NULL, onevalue}, |
92 |
|
}; |
93 |
|
|
94 |
|
#define SFNAME "STATUS" /* status file name */ |
95 |
|
|
96 |
|
struct { |
97 |
|
char host[64]; /* control host name */ |
98 |
< |
int pid; /* control process id */ |
98 |
> |
RT_PID pid; /* control process id */ |
99 |
|
char cfname[128]; /* control file name */ |
100 |
|
int rnext; /* next frame to render */ |
101 |
|
int fnext; /* next frame to filter */ |
119 |
|
char *arcfirst, *arcnext; /* pointers to first and next argument */ |
120 |
|
|
121 |
|
struct pslot { |
122 |
< |
int pid; /* process ID (0 if empty) */ |
122 |
> |
RT_PID pid; /* process ID (0 if empty) */ |
123 |
|
int fout; /* output frame number */ |
124 |
|
int (*rcvf)(); /* recover function */ |
125 |
|
} *pslot; /* process slots */ |
126 |
|
int npslots; /* number of process slots */ |
127 |
|
|
128 |
|
#define phostname(ps) ((ps)->hostname[0] ? (ps)->hostname : astat.host) |
112 |
– |
|
113 |
– |
struct pslot *findpslot(); |
114 |
– |
|
129 |
|
PSERVER *lastpserver; /* last process server with error */ |
130 |
|
|
131 |
< |
VIEW *getview(); |
132 |
< |
char *getexp(); |
131 |
> |
static struct pslot * findpslot(RT_PID pid); |
132 |
> |
static void checkdir(void); |
133 |
> |
static VIEW * getview(int n); |
134 |
|
|
135 |
< |
extern time_t fdate(), time(); |
135 |
> |
static char * dirfile(char *df, register char *path); |
136 |
> |
static char * getexp(int n); |
137 |
> |
static int getblur(double *mbf, double *dbf); |
138 |
> |
static int getastat(void); |
139 |
> |
static void getradfile(char *rfargs); |
140 |
> |
static void badvalue(int vc); |
141 |
> |
static int rmfile(char *fn); |
142 |
> |
static int runcom(char *cs); |
143 |
> |
static int pruncom(char *com, char *ppins, int maxcopies); |
144 |
> |
static void bwait(int ncoms); |
145 |
> |
static RT_PID bruncom(char *com, int fout, int (*rf)()); |
146 |
> |
static int serverdown(void); |
147 |
> |
static pscompfunc donecom; |
148 |
> |
static int countviews(void); |
149 |
> |
static int dofilt(int frame, int rvr); |
150 |
> |
static void archive(void); |
151 |
> |
static int frecover(int frame); |
152 |
> |
static int recover(int frame); |
153 |
> |
static void sethosts(void); |
154 |
> |
static void walkwait(int first, int last, char *vfn); |
155 |
> |
static void animrend(int frame, VIEW *vp); |
156 |
> |
static void transferframes(void); |
157 |
> |
static void filterframes(void); |
158 |
> |
static void renderframes(int nframes); |
159 |
> |
static void animate(void); |
160 |
> |
static void setdefaults(void); |
161 |
> |
static void putastat(void); |
162 |
|
|
163 |
|
|
164 |
< |
main(argc, argv) |
165 |
< |
int argc; |
166 |
< |
char *argv[]; |
164 |
> |
int |
165 |
> |
main( |
166 |
> |
int argc, |
167 |
> |
char *argv[] |
168 |
> |
) |
169 |
|
{ |
170 |
|
int explicate = 0; |
171 |
|
int i; |
193 |
|
cfname = argv[i]; |
194 |
|
/* load variables */ |
195 |
|
loadvars(cfname); |
196 |
+ |
/* check variables */ |
197 |
+ |
checkvalues(); |
198 |
|
/* did we get DIRECTORY? */ |
199 |
|
checkdir(); |
200 |
|
/* check status */ |
228 |
|
quit(1); |
229 |
|
} |
230 |
|
quit(0); |
231 |
+ |
return 0; /* pro forma return */ |
232 |
|
userr: |
233 |
|
fprintf(stderr, "Usage: %s [-s][-n][-w][-e] anim_file\n", progname); |
234 |
|
quit(1); |
235 |
+ |
return 1; /* pro forma return */ |
236 |
|
} |
237 |
|
|
238 |
|
|
239 |
< |
getastat() /* check/set animation status */ |
239 |
> |
static int |
240 |
> |
getastat(void) /* check/set animation status */ |
241 |
|
{ |
242 |
|
char sfname[256]; |
243 |
|
FILE *fp; |
301 |
|
} |
302 |
|
|
303 |
|
|
304 |
< |
putastat() /* put out current status */ |
304 |
> |
static void |
305 |
> |
putastat(void) /* put out current status */ |
306 |
|
{ |
307 |
|
char buf[256]; |
308 |
|
FILE *fp; |
324 |
|
} |
325 |
|
|
326 |
|
|
327 |
< |
checkdir() /* make sure we have our directory */ |
327 |
> |
static void |
328 |
> |
checkdir(void) /* make sure we have our directory */ |
329 |
|
{ |
330 |
|
struct stat stb; |
331 |
|
|
347 |
|
} |
348 |
|
|
349 |
|
|
350 |
< |
setdefaults() /* set default values */ |
350 |
> |
static void |
351 |
> |
setdefaults(void) /* set default values */ |
352 |
|
{ |
353 |
|
extern char *atos(); |
354 |
|
int decades; |
436 |
|
} |
437 |
|
|
438 |
|
|
439 |
< |
sethosts() /* set up process servers */ |
439 |
> |
static void |
440 |
> |
sethosts(void) /* set up process servers */ |
441 |
|
{ |
442 |
|
extern char *iskip(); |
443 |
|
char buf[256], *dir, *uname; |
492 |
|
} |
493 |
|
} |
494 |
|
|
495 |
< |
|
496 |
< |
getradfile(rfargs) /* run rad and get needed variables */ |
445 |
< |
char *rfargs; |
495 |
> |
static void |
496 |
> |
getradfile(char *rfargs) /* run rad and get needed variables */ |
497 |
|
{ |
498 |
|
static short mvar[] = {OCTREE,PFILT,RESOLUTION,EXPOSURE,-1}; |
499 |
|
char combuf[256]; |
500 |
|
register int i; |
501 |
|
register char *cp; |
502 |
+ |
char *pippt = NULL; |
503 |
|
/* create rad command */ |
504 |
|
sprintf(rendopt, " @%s/render.opt", vval(DIRECTORY)); |
505 |
|
sprintf(combuf, |
506 |
|
"rad -v 0 -s -e -w %s OPTFILE=%s | egrep '^[ \t]*(NOMATCH", |
507 |
|
rfargs, rendopt+2); |
508 |
|
cp = combuf; |
509 |
< |
while (*cp) cp++; /* match unset variables */ |
509 |
> |
while (*cp) { |
510 |
> |
if (*cp == '|') pippt = cp; |
511 |
> |
cp++; |
512 |
> |
} /* match unset variables */ |
513 |
|
for (i = 0; mvar[i] >= 0; i++) |
514 |
|
if (!vdef(mvar[i])) { |
515 |
|
*cp++ = '|'; |
516 |
|
strcpy(cp, vnam(mvar[i])); |
517 |
|
while (*cp) cp++; |
518 |
+ |
pippt = NULL; |
519 |
|
} |
520 |
< |
sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY)); |
521 |
< |
cp += 11; /* point to file name */ |
522 |
< |
if (system(combuf)) { |
523 |
< |
fprintf(stderr, "%s: error executing rad command:\n\t%s\n", |
524 |
< |
progname, combuf); |
469 |
< |
quit(1); |
520 |
> |
if (pippt != NULL) |
521 |
> |
strcpy(pippt, "> " NULL_DEVICE); /* nothing to match */ |
522 |
> |
else { |
523 |
> |
sprintf(cp, ")[ \t]*=' > %s/radset.var", vval(DIRECTORY)); |
524 |
> |
cp += 11; /* point to file name */ |
525 |
|
} |
526 |
< |
loadvars(cp); /* load variables and remove file */ |
527 |
< |
unlink(cp); |
526 |
> |
system(combuf); /* ignore exit code */ |
527 |
> |
if (pippt == NULL) { /* load variables and remove file */ |
528 |
> |
loadvars(cp); |
529 |
> |
unlink(cp); |
530 |
> |
} |
531 |
|
} |
532 |
|
|
533 |
|
|
534 |
< |
animate() /* run animation */ |
534 |
> |
static void |
535 |
> |
animate(void) /* run animation */ |
536 |
|
{ |
537 |
|
int xres, yres; |
538 |
|
float pa, mult; |
562 |
|
progname, vnam(INTERP)); |
563 |
|
vval(INTERP) = "0"; |
564 |
|
} |
565 |
< |
if (atoi(vval(MBLUR))) { /* can't handle this yet */ |
565 |
> |
if (strcmp(vval(MBLUR),"0")) { /* can't handle this */ |
566 |
|
if (!nowarn) |
567 |
|
fprintf(stderr, |
568 |
|
"%s: resetting %s=0 for animation\n", |
572 |
|
} |
573 |
|
/* figure # frames per batch */ |
574 |
|
d1 = mult*xres*mult*yres*4; /* space for orig. picture */ |
575 |
< |
if ((i=vint(INTERP)) || atoi(vval(MBLUR))) |
575 |
> |
if ((i=vint(INTERP)) || getblur(NULL, NULL) > 1) |
576 |
|
d1 += mult*xres*mult*yres*sizeof(float); /* Z-buffer */ |
577 |
|
d2 = xres*yres*4; /* space for final picture */ |
578 |
|
frames_batch = (i+1)*(vflt(DISKSPACE)*1048576.-d1)/(d1+i*d2); |
582 |
|
quit(1); |
583 |
|
} |
584 |
|
/* initialize archive argument list */ |
585 |
< |
i = 16; |
527 |
< |
if (vdef(ARCHIVE) && strlen(vval(ARCHIVE)) > i) |
528 |
< |
i = strlen(vval(ARCHIVE)); |
585 |
> |
i = vdef(ARCHIVE) ? strlen(vval(ARCHIVE))+132 : 132; |
586 |
|
arcnext = arcfirst = arcargs + i; |
587 |
|
/* initialize status file */ |
588 |
|
if (astat.rnext == 0) |
603 |
|
} |
604 |
|
|
605 |
|
|
606 |
< |
renderframes(nframes) /* render next nframes frames */ |
607 |
< |
int nframes; |
606 |
> |
static void |
607 |
> |
renderframes(int nframes) /* render next nframes frames */ |
608 |
|
{ |
609 |
|
static char vendbuf[16]; |
610 |
|
VIEW *vp; |
660 |
|
} |
661 |
|
|
662 |
|
|
663 |
< |
filterframes() /* catch up with filtering */ |
663 |
> |
static void |
664 |
> |
filterframes(void) /* catch up with filtering */ |
665 |
|
{ |
608 |
– |
VIEW *vp; |
666 |
|
register int i; |
667 |
|
|
668 |
|
if (astat.tnext < astat.fnext) /* other work to do first */ |
669 |
|
return; |
670 |
|
/* filter each view */ |
671 |
< |
for (i = astat.fnext; i < astat.rnext; i++) { |
672 |
< |
if ((vp = getview(i)) == NULL) { /* get view i */ |
673 |
< |
fprintf(stderr, |
617 |
< |
"%s: unexpected error reading view for frame %d\n", |
618 |
< |
progname, i); |
619 |
< |
quit(1); |
620 |
< |
} |
621 |
< |
dofilt(i, vp, getexp(i), 0); /* filter frame */ |
622 |
< |
} |
671 |
> |
for (i = astat.fnext; i < astat.rnext; i++) |
672 |
> |
dofilt(i, 0); |
673 |
> |
|
674 |
|
bwait(0); /* wait for filter processes */ |
675 |
|
archive(); /* archive originals */ |
676 |
|
astat.fnext = i; /* update status */ |
678 |
|
} |
679 |
|
|
680 |
|
|
681 |
< |
transferframes() /* catch up with picture transfers */ |
681 |
> |
static void |
682 |
> |
transferframes(void) /* catch up with picture transfers */ |
683 |
|
{ |
684 |
< |
char combuf[10240]; |
684 |
> |
char combuf[10240], *fbase; |
685 |
|
register char *cp; |
686 |
|
register int i; |
687 |
|
|
692 |
|
putastat(); /* update status */ |
693 |
|
return; |
694 |
|
} |
695 |
< |
strcpy(combuf, vval(TRANSFER)); /* start transfer command */ |
696 |
< |
cp = combuf + strlen(combuf); |
695 |
> |
strcpy(combuf, "cd "); /* start transfer command */ |
696 |
> |
fbase = dirfile(cp = combuf+3, vval(BASENAME)); |
697 |
> |
if (*cp) { |
698 |
> |
while (*++cp) ; |
699 |
> |
*cp++ = ';'; *cp++ = ' '; |
700 |
> |
} else |
701 |
> |
cp = combuf; |
702 |
> |
strcpy(cp, vval(TRANSFER)); |
703 |
> |
while (*cp) cp++; |
704 |
|
/* make argument list */ |
705 |
|
for (i = astat.tnext; i < astat.fnext; i++) { |
706 |
|
*cp++ = ' '; |
707 |
< |
sprintf(cp, vval(BASENAME), i); |
707 |
> |
sprintf(cp, fbase, i); |
708 |
|
while (*cp) cp++; |
709 |
|
strcpy(cp, ".pic"); |
710 |
|
cp += 4; |
719 |
|
} |
720 |
|
|
721 |
|
|
722 |
< |
animrend(frame, vp) /* start animation frame */ |
723 |
< |
int frame; |
724 |
< |
VIEW *vp; |
722 |
> |
static void |
723 |
> |
animrend( /* start animation frame */ |
724 |
> |
int frame, |
725 |
> |
VIEW *vp |
726 |
> |
) |
727 |
|
{ |
667 |
– |
extern int recover(); |
728 |
|
char combuf[2048]; |
729 |
|
char fname[128]; |
730 |
|
|
738 |
|
} |
739 |
|
|
740 |
|
|
741 |
< |
walkwait(first, last, vfn) /* walk-through frames */ |
742 |
< |
int first, last; |
743 |
< |
char *vfn; |
741 |
> |
static void |
742 |
> |
walkwait( /* walk-through frames */ |
743 |
> |
int first, |
744 |
> |
int last, |
745 |
> |
char *vfn |
746 |
> |
) |
747 |
|
{ |
748 |
+ |
double mblurf, dblurf; |
749 |
+ |
int nblur = getblur(&mblurf, &dblurf); |
750 |
|
char combuf[2048]; |
751 |
< |
char *inspoint; |
751 |
> |
register char *inspoint; |
752 |
|
register int i; |
753 |
|
|
754 |
|
if (!noaction && vint(INTERP)) /* create dummy frames */ |
759 |
|
close(open(combuf, O_RDONLY|O_CREAT, 0666)); |
760 |
|
} |
761 |
|
/* create command */ |
762 |
< |
sprintf(combuf, "rpict%s -w0", rendopt); |
763 |
< |
if (vint(INTERP) || atoi(vval(MBLUR))) |
764 |
< |
sprintf(combuf+strlen(combuf), " -z %s.zbf", vval(BASENAME)); |
765 |
< |
sprintf(combuf+strlen(combuf), " -o %s.unf %s -S %d", |
762 |
> |
sprintf(combuf, "rpict%s%s -w0", rendopt, |
763 |
> |
viewopt(getview(first>1 ? first-1 : 1))); |
764 |
> |
inspoint = combuf; |
765 |
> |
while (*inspoint) inspoint++; |
766 |
> |
if (nblur) { |
767 |
> |
sprintf(inspoint, " -pm %.3f", mblurf/nblur); |
768 |
> |
while (*inspoint) inspoint++; |
769 |
> |
sprintf(inspoint, " -pd %.3f", dblurf/nblur); |
770 |
> |
while (*inspoint) inspoint++; |
771 |
> |
} |
772 |
> |
if (nblur > 1 || vint(INTERP)) { |
773 |
> |
sprintf(inspoint, " -z %s.zbf", vval(BASENAME)); |
774 |
> |
while (*inspoint) inspoint++; |
775 |
> |
} |
776 |
> |
sprintf(inspoint, " -o %s.unf %s -S %d", |
777 |
|
vval(BASENAME), rresopt, first); |
778 |
< |
inspoint = combuf + strlen(combuf); |
778 |
> |
while (*inspoint) inspoint++; |
779 |
|
sprintf(inspoint, " %s < %s", vval(OCTREE), vfn); |
780 |
|
/* run in parallel */ |
781 |
|
i = (last-first+1)/(vint(INTERP)+1); |
795 |
|
} |
796 |
|
|
797 |
|
|
798 |
< |
int |
799 |
< |
recover(frame) /* recover the specified frame */ |
724 |
< |
int frame; |
798 |
> |
static int |
799 |
> |
recover(int frame) /* recover the specified frame */ |
800 |
|
{ |
801 |
|
static int *rfrm; /* list of recovered frames */ |
802 |
|
static int nrfrms = 0; |
803 |
+ |
double mblurf, dblurf; |
804 |
+ |
int nblur = getblur(&mblurf, &dblurf); |
805 |
|
char combuf[2048]; |
806 |
|
char fname[128]; |
807 |
|
register char *cp; |
817 |
|
vval(ANIMATE), frame, rendopt); |
818 |
|
else |
819 |
|
sprintf(combuf, "rpict%s -w0", rendopt); |
820 |
< |
cp = combuf + strlen(combuf); |
821 |
< |
if (vint(INTERP) || atoi(vval(MBLUR))) { |
820 |
> |
cp = combuf; |
821 |
> |
while (*cp) cp++; |
822 |
> |
if (nblur) { |
823 |
> |
sprintf(cp, " -pm %.3f", mblurf/nblur); |
824 |
> |
while (*cp) cp++; |
825 |
> |
sprintf(cp, " -pd %.3f", dblurf/nblur); |
826 |
> |
while (*cp) cp++; |
827 |
> |
} |
828 |
> |
if (nblur > 1 || vint(INTERP)) { |
829 |
|
sprintf(cp, " -z %s.zbf", fname); |
830 |
|
while (*cp) cp++; |
831 |
|
} |
839 |
|
return(1); |
840 |
|
/* add frame to recovered list */ |
841 |
|
if (nrfrms) |
842 |
< |
rfrm = (int *)realloc((char *)rfrm, (nrfrms+1)*sizeof(int)); |
842 |
> |
rfrm = (int *)realloc((void *)rfrm, (nrfrms+1)*sizeof(int)); |
843 |
|
else |
844 |
|
rfrm = (int *)malloc(sizeof(int)); |
845 |
|
if (rfrm == NULL) { |
851 |
|
} |
852 |
|
|
853 |
|
|
854 |
< |
int |
855 |
< |
frecover(frame) /* recover filtered frame */ |
772 |
< |
int frame; |
854 |
> |
static int |
855 |
> |
frecover(int frame) /* recover filtered frame */ |
856 |
|
{ |
857 |
< |
VIEW *vp; |
775 |
< |
char *ex; |
776 |
< |
|
777 |
< |
vp = getview(frame); |
778 |
< |
ex = getexp(frame); |
779 |
< |
if (dofilt(frame, vp, ex, 2) && dofilt(frame, vp, ex, 1)) |
857 |
> |
if (dofilt(frame, 2) && dofilt(frame, 1)) |
858 |
|
return(1); |
859 |
|
return(0); |
860 |
|
} |
861 |
|
|
862 |
|
|
863 |
< |
archive() /* archive and remove renderings */ |
863 |
> |
static void |
864 |
> |
archive(void) /* archive and remove renderings */ |
865 |
|
{ |
866 |
|
#define RMCOML (sizeof(rmcom)-1) |
867 |
|
static char rmcom[] = "rm -f"; |
868 |
< |
register int i; |
868 |
> |
char basedir[128]; |
869 |
> |
int dlen, alen; |
870 |
> |
register int j; |
871 |
|
|
872 |
|
if (arcnext == arcfirst) |
873 |
|
return; /* nothing to do */ |
874 |
+ |
dirfile(basedir, vval(BASENAME)); |
875 |
+ |
dlen = strlen(basedir); |
876 |
|
if (vdef(ARCHIVE)) { /* run archive command */ |
877 |
< |
i = strlen(vval(ARCHIVE)); |
878 |
< |
strncpy(arcfirst-i, vval(ARCHIVE), i); |
879 |
< |
if (runcom(arcfirst-i)) { |
877 |
> |
alen = strlen(vval(ARCHIVE)); |
878 |
> |
if (dlen) { |
879 |
> |
j = alen + dlen + 5; |
880 |
> |
strncpy(arcfirst-j, "cd ", 3); |
881 |
> |
strncpy(arcfirst-j+3, basedir, dlen); |
882 |
> |
(arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' '; |
883 |
> |
} else |
884 |
> |
j = alen; |
885 |
> |
strncpy(arcfirst-alen, vval(ARCHIVE), alen); |
886 |
> |
if (runcom(arcfirst-j)) { |
887 |
|
fprintf(stderr, "%s: error running archive command\n", |
888 |
|
progname); |
889 |
|
quit(1); |
890 |
|
} |
891 |
|
} |
892 |
+ |
if (dlen) { |
893 |
+ |
j = RMCOML + dlen + 5; |
894 |
+ |
strncpy(arcfirst-j, "cd ", 3); |
895 |
+ |
strncpy(arcfirst-j+3, basedir, dlen); |
896 |
+ |
(arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' '; |
897 |
+ |
} else |
898 |
+ |
j = RMCOML; |
899 |
|
/* run remove command */ |
900 |
|
strncpy(arcfirst-RMCOML, rmcom, RMCOML); |
901 |
< |
runcom(arcfirst-RMCOML); |
901 |
> |
runcom(arcfirst-j); |
902 |
|
arcnext = arcfirst; /* reset argument list */ |
903 |
|
#undef RMCOML |
904 |
|
} |
905 |
|
|
906 |
|
|
907 |
< |
int |
908 |
< |
dofilt(frame, vp, ep, rvr) /* filter frame */ |
909 |
< |
int frame; |
910 |
< |
VIEW *vp; |
911 |
< |
char *ep; |
815 |
< |
int rvr; |
907 |
> |
static int |
908 |
> |
dofilt( /* filter frame */ |
909 |
> |
int frame, |
910 |
> |
int rvr |
911 |
> |
) |
912 |
|
{ |
817 |
– |
extern int frecover(); |
913 |
|
static int iter = 0; |
914 |
< |
char fnbefore[128], fnafter[128]; |
914 |
> |
double mblurf, dblurf; |
915 |
> |
int nblur = getblur(&mblurf, &dblurf); |
916 |
> |
VIEW *vp = getview(frame); |
917 |
> |
char *ep = getexp(frame); |
918 |
> |
char fnbefore[128], fnafter[128], *fbase; |
919 |
|
char combuf[1024], fname0[128], fname1[128]; |
920 |
|
int usepinterp, usepfilt, nora_rgbe; |
921 |
|
int frseq[2]; |
922 |
|
/* check what is needed */ |
923 |
< |
usepinterp = atoi(vval(MBLUR)); |
924 |
< |
usepfilt = pfiltalways | ep==NULL; |
923 |
> |
if (vp == NULL) { |
924 |
> |
fprintf(stderr, |
925 |
> |
"%s: unexpected error reading view for frame %d\n", |
926 |
> |
progname, frame); |
927 |
> |
quit(1); |
928 |
> |
} |
929 |
> |
usepinterp = (nblur > 1); |
930 |
> |
usepfilt = pfiltalways | (ep==NULL); |
931 |
|
if (ep != NULL && !strcmp(ep, "1")) |
932 |
|
ep = "+0"; |
933 |
|
nora_rgbe = strcmp(vval(OVERSAMP),"1") || ep==NULL || |
935 |
|
/* compute rendered views */ |
936 |
|
frseq[0] = frame - ((frame-1) % (vint(INTERP)+1)); |
937 |
|
frseq[1] = frseq[0] + vint(INTERP) + 1; |
938 |
+ |
fbase = dirfile(NULL, vval(BASENAME)); |
939 |
|
if (frseq[1] > vint(END)) |
940 |
|
frseq[1] = vint(END); |
941 |
|
if (frseq[1] == frame) { /* pfilt only */ |
945 |
|
} else if (frseq[0] == frame) { /* no interpolation needed */ |
946 |
|
if (!rvr && frame > 1+vint(INTERP)) { /* archive previous */ |
947 |
|
*arcnext++ = ' '; |
948 |
< |
sprintf(arcnext, vval(BASENAME), frame-vint(INTERP)-1); |
948 |
> |
sprintf(arcnext, fbase, frame-vint(INTERP)-1); |
949 |
|
while (*arcnext) arcnext++; |
950 |
|
strcpy(arcnext, ".unf"); |
951 |
|
arcnext += 4; |
952 |
|
if (usepinterp || vint(INTERP)) { /* and Z-buf */ |
953 |
|
*arcnext++ = ' '; |
954 |
< |
sprintf(arcnext, vval(BASENAME), |
849 |
< |
frame-vint(INTERP)-1); |
954 |
> |
sprintf(arcnext, fbase, frame-vint(INTERP)-1); |
955 |
|
while (*arcnext) arcnext++; |
956 |
|
strcpy(arcnext, ".zbf"); |
957 |
|
arcnext += 4; |
971 |
|
if (usepinterp) { /* using pinterp */ |
972 |
|
if (rvr == 2 && recover(frseq[1])) /* recover after? */ |
973 |
|
return(1); |
974 |
< |
if (atoi(vval(MBLUR))) { |
870 |
< |
FILE *fp; /* motion blurring */ |
974 |
> |
if (nblur > 1) { /* with pdmblur */ |
975 |
|
sprintf(fname0, "%s/vw0%c", vval(DIRECTORY), |
976 |
|
'a'+(iter%26)); |
873 |
– |
if ((fp = fopen(fname0, "w")) == NULL) { |
874 |
– |
perror(fname0); quit(1); |
875 |
– |
} |
876 |
– |
fputs(VIEWSTR, fp); |
877 |
– |
fprintview(vp, fp); |
878 |
– |
putc('\n', fp); fclose(fp); |
879 |
– |
if ((vp = getview(frame+1)) == NULL) { |
880 |
– |
fprintf(stderr, |
881 |
– |
"%s: unexpected error reading view for frame %d\n", |
882 |
– |
progname, frame+1); |
883 |
– |
quit(1); |
884 |
– |
} |
977 |
|
sprintf(fname1, "%s/vw1%c", vval(DIRECTORY), |
978 |
|
'a'+(iter%26)); |
979 |
< |
if ((fp = fopen(fname1, "w")) == NULL) { |
980 |
< |
perror(fname1); quit(1); |
979 |
> |
if (!noaction) { |
980 |
> |
FILE *fp; /* motion blurring */ |
981 |
> |
if ((fp = fopen(fname0, "w")) == NULL) { |
982 |
> |
perror(fname0); quit(1); |
983 |
> |
} |
984 |
> |
fputs(VIEWSTR, fp); |
985 |
> |
fprintview(vp, fp); |
986 |
> |
putc('\n', fp); fclose(fp); |
987 |
> |
if ((vp = getview(frame+1)) == NULL) { |
988 |
> |
fprintf(stderr, |
989 |
> |
"%s: unexpected error reading view for frame %d\n", |
990 |
> |
progname, frame+1); |
991 |
> |
quit(1); |
992 |
> |
} |
993 |
> |
if ((fp = fopen(fname1, "w")) == NULL) { |
994 |
> |
perror(fname1); quit(1); |
995 |
> |
} |
996 |
> |
fputs(VIEWSTR, fp); |
997 |
> |
fprintview(vp, fp); |
998 |
> |
putc('\n', fp); fclose(fp); |
999 |
|
} |
890 |
– |
fputs(VIEWSTR, fp); |
891 |
– |
fprintview(vp, fp); |
892 |
– |
putc('\n', fp); fclose(fp); |
1000 |
|
sprintf(combuf, |
1001 |
< |
"(pmblur %s %d %s %s; rm -f %s %s) | pinterp -B", |
1002 |
< |
*sskip(vval(MBLUR)) ? sskip2(vval(MBLUR),1) : "1", |
896 |
< |
atoi(vval(MBLUR)), |
1001 |
> |
"(pmdblur %.3f %.3f %d %s %s; rm -f %s %s) | pinterp -B -a", |
1002 |
> |
mblurf, dblurf, nblur, |
1003 |
|
fname0, fname1, fname0, fname1); |
1004 |
|
iter++; |
1005 |
|
} else /* no blurring */ |
1013 |
|
if (usepfilt) |
1014 |
|
sprintf(combuf+strlen(combuf), " %s", rresopt); |
1015 |
|
else |
1016 |
< |
sprintf(combuf+strlen(combuf), " %s -e %s", |
1016 |
> |
sprintf(combuf+strlen(combuf), " -a %s -e %s", |
1017 |
|
fresopt, ep); |
1018 |
|
sprintf(combuf+strlen(combuf), " %s.unf %s.zbf", |
1019 |
|
fnbefore, fnbefore); |
1060 |
|
} |
1061 |
|
|
1062 |
|
|
1063 |
< |
VIEW * |
1064 |
< |
getview(n) /* get view number n */ |
959 |
< |
int n; |
1063 |
> |
static VIEW * |
1064 |
> |
getview(int n) /* get view number n */ |
1065 |
|
{ |
1066 |
|
static FILE *viewfp = NULL; /* view file pointer */ |
1067 |
|
static int viewnum = 0; /* current view number */ |
1073 |
|
fclose(viewfp); |
1074 |
|
viewfp = NULL; |
1075 |
|
viewnum = 0; |
1076 |
< |
copystruct(&curview, &stdview); |
1076 |
> |
curview = stdview; |
1077 |
|
} |
1078 |
|
return(NULL); |
1079 |
|
} |
1080 |
< |
if (viewfp == NULL) { /* open file */ |
1080 |
> |
if (viewfp == NULL) { /* open file */ |
1081 |
|
if ((viewfp = fopen(vval(VIEWFILE), "r")) == NULL) { |
1082 |
|
perror(vval(VIEWFILE)); |
1083 |
|
quit(1); |
1084 |
|
} |
1085 |
< |
} else if (n < viewnum) { /* rewind file */ |
1085 |
> |
} else if (n > 0 && n < viewnum) { /* rewind file */ |
1086 |
|
if (viewnum == 1 && feof(viewfp)) |
1087 |
|
return(&curview); /* just one view */ |
1088 |
|
if (fseek(viewfp, 0L, 0) == EOF) { |
1089 |
|
perror(vval(VIEWFILE)); |
1090 |
|
quit(1); |
1091 |
|
} |
1092 |
< |
copystruct(&curview, &stdview); |
1092 |
> |
curview = stdview; |
1093 |
|
viewnum = 0; |
1094 |
|
} |
1095 |
+ |
if (n < 0) { /* get next view */ |
1096 |
+ |
register int c = getc(viewfp); |
1097 |
+ |
if (c == EOF) |
1098 |
+ |
return((VIEW *)NULL); /* that's it */ |
1099 |
+ |
ungetc(c, viewfp); |
1100 |
+ |
n = viewnum + 1; |
1101 |
+ |
} |
1102 |
|
while (n > viewnum) { /* scan to desired view */ |
1103 |
|
if (fgets(linebuf, sizeof(linebuf), viewfp) == NULL) |
1104 |
|
return(viewnum==1 ? &curview : (VIEW *)NULL); |
1109 |
|
} |
1110 |
|
|
1111 |
|
|
1112 |
< |
int |
1113 |
< |
countviews() /* count views in view file */ |
1112 |
> |
static int |
1113 |
> |
countviews(void) /* count views in view file */ |
1114 |
|
{ |
1115 |
< |
register int n = 0; |
1115 |
> |
int n; |
1116 |
|
|
1117 |
< |
while (getview(n+1) != NULL) |
1117 |
> |
if (getview(n=1) == NULL) |
1118 |
> |
return(0); |
1119 |
> |
while (getview(-1) != NULL) |
1120 |
|
n++; |
1121 |
|
return(n); |
1122 |
|
} |
1123 |
|
|
1124 |
|
|
1125 |
< |
char * |
1126 |
< |
getexp(n) /* get exposure for nth frame */ |
1013 |
< |
int n; |
1125 |
> |
static char * |
1126 |
> |
getexp(int n) /* get exposure for nth frame */ |
1127 |
|
{ |
1128 |
|
extern char *fskip(); |
1129 |
|
static char expval[32]; |
1135 |
|
if (n == 0) { /* signal to close file */ |
1136 |
|
if (expfp != NULL) { |
1137 |
|
fclose(expfp); |
1138 |
< |
free((char *)exppos); |
1138 |
> |
free((void *)exppos); |
1139 |
|
expfp = NULL; |
1140 |
|
} |
1141 |
|
return(NULL); |
1192 |
|
} |
1193 |
|
|
1194 |
|
|
1195 |
< |
struct pslot * |
1196 |
< |
findpslot(pid) /* find or allocate a process slot */ |
1084 |
< |
int pid; |
1195 |
> |
static struct pslot * |
1196 |
> |
findpslot(RT_PID pid) /* find or allocate a process slot */ |
1197 |
|
{ |
1198 |
|
register struct pslot *psempty = NULL; |
1199 |
|
register int i; |
1208 |
|
} |
1209 |
|
|
1210 |
|
|
1211 |
< |
int |
1212 |
< |
donecom(ps, pn, status) /* clean up after finished process */ |
1213 |
< |
PSERVER *ps; |
1214 |
< |
int pn; |
1215 |
< |
int status; |
1211 |
> |
static int |
1212 |
> |
donecom( /* clean up after finished process */ |
1213 |
> |
PSERVER *ps, |
1214 |
> |
int pn, |
1215 |
> |
int status |
1216 |
> |
) |
1217 |
|
{ |
1218 |
< |
register PROC *pp; |
1218 |
> |
register NETPROC *pp; |
1219 |
|
register struct pslot *psl; |
1220 |
|
|
1221 |
|
pp = ps->proc + pn; |
1250 |
|
} |
1251 |
|
|
1252 |
|
|
1253 |
< |
int |
1254 |
< |
serverdown() /* check status of last process server */ |
1253 |
> |
static int |
1254 |
> |
serverdown(void) /* check status of last process server */ |
1255 |
|
{ |
1256 |
|
if (lastpserver == NULL || !lastpserver->hostname[0]) |
1257 |
|
return(0); |
1267 |
|
} |
1268 |
|
|
1269 |
|
|
1270 |
< |
int |
1271 |
< |
bruncom(com, fout, rf) /* run a command in the background */ |
1272 |
< |
char *com; |
1273 |
< |
int fout; |
1274 |
< |
int (*rf)(); |
1270 |
> |
static RT_PID |
1271 |
> |
bruncom( /* run a command in the background */ |
1272 |
> |
char *com, |
1273 |
> |
int fout, |
1274 |
> |
int (*rf)() |
1275 |
> |
) |
1276 |
|
{ |
1277 |
< |
int pid; |
1277 |
> |
RT_PID pid; |
1278 |
|
register struct pslot *psl; |
1279 |
|
|
1280 |
|
if (noaction) { |
1287 |
|
bwait(1); |
1288 |
|
if (!silent) { /* echo command */ |
1289 |
|
PSERVER *ps; |
1290 |
< |
int psn = pid; |
1290 |
> |
RT_PID psn = pid; |
1291 |
|
ps = findjob(&psn); |
1292 |
|
printf("\t%s\n", com); |
1293 |
|
printf("\tProcess started on %s\n", phostname(ps)); |
1301 |
|
} |
1302 |
|
|
1303 |
|
|
1304 |
< |
bwait(ncoms) /* wait for batch job(s) to finish */ |
1305 |
< |
int ncoms; |
1304 |
> |
static void |
1305 |
> |
bwait(int ncoms) /* wait for batch job(s) to finish */ |
1306 |
|
{ |
1307 |
|
int status; |
1308 |
|
|
1316 |
|
} |
1317 |
|
|
1318 |
|
|
1319 |
< |
int |
1320 |
< |
pruncom(com, ppins, maxcopies) /* run a command in parallel over network */ |
1321 |
< |
char *com, *ppins; |
1322 |
< |
int maxcopies; |
1319 |
> |
static int |
1320 |
> |
pruncom( /* run a command in parallel over network */ |
1321 |
> |
char *com, |
1322 |
> |
char *ppins, |
1323 |
> |
int maxcopies |
1324 |
> |
) |
1325 |
|
{ |
1326 |
|
int retstatus = 0; |
1327 |
|
int hostcopies; |
1343 |
|
strcpy(com1=buf, com); /* build -PP command */ |
1344 |
|
sprintf(com1+(ppins-com), " -PP %s/%s.persist", |
1345 |
|
vval(DIRECTORY), phostname(ps)); |
1346 |
+ |
unlink(com1+(ppins-com)+5); |
1347 |
|
strcat(com1, ppins); |
1348 |
|
} else |
1349 |
|
com1 = com; |
1388 |
|
} |
1389 |
|
|
1390 |
|
|
1391 |
< |
runcom(cs) /* run a command locally and wait for it */ |
1392 |
< |
char *cs; |
1391 |
> |
static int |
1392 |
> |
runcom(char *cs) /* run a command locally and wait for it */ |
1393 |
|
{ |
1394 |
|
if (!silent) /* echo it */ |
1395 |
|
printf("\t%s\n", cs); |
1400 |
|
} |
1401 |
|
|
1402 |
|
|
1403 |
< |
rmfile(fn) /* remove a file */ |
1404 |
< |
char *fn; |
1403 |
> |
static int |
1404 |
> |
rmfile(char *fn) /* remove a file */ |
1405 |
|
{ |
1406 |
|
if (!silent) |
1407 |
< |
#ifdef MSDOS |
1407 |
> |
#ifdef _WIN32 |
1408 |
|
printf("\tdel %s\n", fn); |
1409 |
|
#else |
1410 |
|
printf("\trm -f %s\n", fn); |
1415 |
|
} |
1416 |
|
|
1417 |
|
|
1418 |
< |
badvalue(vc) /* report bad variable value and exit */ |
1419 |
< |
int vc; |
1418 |
> |
static void |
1419 |
> |
badvalue(int vc) /* report bad variable value and exit */ |
1420 |
|
{ |
1421 |
|
fprintf(stderr, "%s: bad value for variable '%s'\n", |
1422 |
|
progname, vnam(vc)); |
1423 |
|
quit(1); |
1424 |
+ |
} |
1425 |
+ |
|
1426 |
+ |
|
1427 |
+ |
static char * |
1428 |
+ |
dirfile( /* separate path into directory and file */ |
1429 |
+ |
char *df, |
1430 |
+ |
register char *path |
1431 |
+ |
) |
1432 |
+ |
{ |
1433 |
+ |
register int i; |
1434 |
+ |
int psep; |
1435 |
+ |
|
1436 |
+ |
for (i = 0, psep = -1; path[i]; i++) |
1437 |
+ |
if (path[i] == '/') |
1438 |
+ |
psep = i; |
1439 |
+ |
if (df != NULL) { |
1440 |
+ |
if (psep == 0) { |
1441 |
+ |
df[0] = '/'; |
1442 |
+ |
df[1] = '\0'; |
1443 |
+ |
} else if (psep > 0) { |
1444 |
+ |
strncpy(df, path, psep); |
1445 |
+ |
df[psep] = '\0'; |
1446 |
+ |
} else |
1447 |
+ |
df[0] = '\0'; |
1448 |
+ |
} |
1449 |
+ |
return(path+psep+1); |
1450 |
+ |
} |
1451 |
+ |
|
1452 |
+ |
|
1453 |
+ |
static int |
1454 |
+ |
getblur(double *mbf, double *dbf) /* get # blur samples (and fraction) */ |
1455 |
+ |
{ |
1456 |
+ |
double mblurf, dblurf; |
1457 |
+ |
int nmblur, ndblur; |
1458 |
+ |
char *s; |
1459 |
+ |
/* get motion blur */ |
1460 |
+ |
if (!vdef(MBLUR) || (mblurf = atof(vval(MBLUR))) < 0.0) |
1461 |
+ |
mblurf = 0.0; |
1462 |
+ |
if (mbf != NULL) |
1463 |
+ |
*mbf = mblurf; |
1464 |
+ |
if (mblurf <= FTINY) |
1465 |
+ |
nmblur = 0; |
1466 |
+ |
else if (!*(s = sskip(vval(MBLUR)))) |
1467 |
+ |
nmblur = DEF_NBLUR; |
1468 |
+ |
else if ((nmblur = atoi(s)) <= 0) |
1469 |
+ |
nmblur = 1; |
1470 |
+ |
/* get depth-of-field blur */ |
1471 |
+ |
if (!vdef(DBLUR) || (dblurf = atof(vval(DBLUR))) < 0.0) |
1472 |
+ |
dblurf = 0.0; |
1473 |
+ |
if (dbf != NULL) |
1474 |
+ |
*dbf = dblurf; |
1475 |
+ |
if (dblurf <= FTINY) |
1476 |
+ |
ndblur = 0; |
1477 |
+ |
else if (!*(s = sskip(vval(DBLUR)))) |
1478 |
+ |
ndblur = DEF_NBLUR; |
1479 |
+ |
else if ((ndblur = atoi(s)) <= 0) |
1480 |
+ |
ndblur = 1; |
1481 |
+ |
if ((nmblur == 1) & (ndblur == 1)) |
1482 |
+ |
return(1); |
1483 |
+ |
/* return combined samples */ |
1484 |
+ |
return(nmblur + ndblur); |
1485 |
|
} |