37 |
|
#define ANIMATE 0 /* animation command */ |
38 |
|
#define ARCHIVE 1 /* archiving command */ |
39 |
|
#define BASENAME 2 /* output image base name */ |
40 |
< |
#define DIRECTORY 3 /* working (sub)directory */ |
41 |
< |
#define DISKSPACE 4 /* how much disk space to use */ |
42 |
< |
#define END 5 /* ending frame number */ |
43 |
< |
#define EXPOSURE 6 /* how to compute exposure */ |
44 |
< |
#define HOST 7 /* rendering host machine */ |
45 |
< |
#define INTERP 8 /* # frames to interpolate */ |
46 |
< |
#define MBLUR 9 /* motion blur parameters */ |
47 |
< |
#define NEXTANIM 10 /* next animation file */ |
48 |
< |
#define OCTREE 11 /* octree file name */ |
49 |
< |
#define OVERSAMP 12 /* # times to oversample image */ |
50 |
< |
#define PFILT 13 /* pfilt options */ |
51 |
< |
#define PINTERP 14 /* pinterp options */ |
52 |
< |
#define RENDER 15 /* rendering options */ |
53 |
< |
#define RESOLUTION 16 /* desired final resolution */ |
54 |
< |
#define RIF 17 /* rad input file */ |
55 |
< |
#define RSH 18 /* remote shell script or program */ |
56 |
< |
#define RTRACE 19 /* use rtrace with pinterp? */ |
57 |
< |
#define START 20 /* starting frame number */ |
58 |
< |
#define TRANSFER 21 /* frame transfer command */ |
59 |
< |
#define VIEWFILE 22 /* animation frame views */ |
40 |
> |
#define DBLUR 3 /* depth of field blur */ |
41 |
> |
#define DIRECTORY 4 /* working (sub)directory */ |
42 |
> |
#define DISKSPACE 5 /* how much disk space to use */ |
43 |
> |
#define END 6 /* ending frame number */ |
44 |
> |
#define EXPOSURE 7 /* how to compute exposure */ |
45 |
> |
#define HOST 8 /* rendering host machine */ |
46 |
> |
#define INTERP 9 /* # frames to interpolate */ |
47 |
> |
#define MBLUR 10 /* motion blur parameters */ |
48 |
> |
#define NEXTANIM 11 /* next animation file */ |
49 |
> |
#define OCTREE 12 /* octree file name */ |
50 |
> |
#define OVERSAMP 13 /* # times to oversample image */ |
51 |
> |
#define PFILT 14 /* pfilt options */ |
52 |
> |
#define PINTERP 15 /* pinterp options */ |
53 |
> |
#define RENDER 16 /* rendering options */ |
54 |
> |
#define RESOLUTION 17 /* desired final resolution */ |
55 |
> |
#define RIF 18 /* rad input file */ |
56 |
> |
#define RSH 19 /* remote shell script or program */ |
57 |
> |
#define RTRACE 20 /* use rtrace with pinterp? */ |
58 |
> |
#define START 21 /* starting frame number */ |
59 |
> |
#define TRANSFER 22 /* frame transfer command */ |
60 |
> |
#define VIEWFILE 23 /* animation frame views */ |
61 |
|
|
62 |
< |
int NVARS = 23; /* total number of variables */ |
62 |
> |
int NVARS = 24; /* total number of variables */ |
63 |
|
|
64 |
|
VARIABLE vv[] = { /* variable-value pairs */ |
65 |
|
{"ANIMATE", 2, 0, NULL, onevalue}, |
66 |
|
{"ARCHIVE", 2, 0, NULL, onevalue}, |
67 |
|
{"BASENAME", 3, 0, NULL, onevalue}, |
68 |
+ |
{"DBLUR", 2, 0, NULL, onevalue}, |
69 |
|
{"DIRECTORY", 3, 0, NULL, onevalue}, |
70 |
|
{"DISKSPACE", 3, 0, NULL, fltvalue}, |
71 |
|
{"END", 2, 0, NULL, intvalue}, |
131 |
|
|
132 |
|
static char * dirfile(char *df, register char *path); |
133 |
|
static char * getexp(int n); |
134 |
< |
static int getblur(double *bf); |
134 |
> |
static int getblur(double *mbf, double *dbf); |
135 |
|
static int getastat(void); |
136 |
|
static void getradfile(char *rfargs); |
137 |
|
static void badvalue(int vc); |
569 |
|
} |
570 |
|
/* figure # frames per batch */ |
571 |
|
d1 = mult*xres*mult*yres*4; /* space for orig. picture */ |
572 |
< |
if ((i=vint(INTERP)) || getblur(NULL) > 1) |
572 |
> |
if ((i=vint(INTERP)) || getblur(NULL, NULL) > 1) |
573 |
|
d1 += mult*xres*mult*yres*sizeof(float); /* Z-buffer */ |
574 |
|
d2 = xres*yres*4; /* space for final picture */ |
575 |
|
frames_batch = (i+1)*(vflt(DISKSPACE)*1048576.-d1)/(d1+i*d2); |
742 |
|
char *vfn |
743 |
|
) |
744 |
|
{ |
745 |
< |
double blurf; |
746 |
< |
int nblur = getblur(&blurf); |
745 |
> |
double mblurf, dblurf; |
746 |
> |
int nblur = getblur(&mblurf, &dblurf); |
747 |
|
char combuf[2048]; |
748 |
|
register char *inspoint; |
749 |
|
register int i; |
761 |
|
inspoint = combuf; |
762 |
|
while (*inspoint) inspoint++; |
763 |
|
if (nblur) { |
764 |
< |
sprintf(inspoint, " -pm %.3f", blurf/nblur); |
764 |
> |
sprintf(inspoint, " -pm %.3f", mblurf/nblur); |
765 |
|
while (*inspoint) inspoint++; |
766 |
+ |
sprintf(inspoint, " -pd %.3f", dblurf/nblur); |
767 |
+ |
while (*inspoint) inspoint++; |
768 |
|
} |
769 |
|
if (nblur > 1 || vint(INTERP)) { |
770 |
|
sprintf(inspoint, " -z %s.zbf", vval(BASENAME)); |
797 |
|
{ |
798 |
|
static int *rfrm; /* list of recovered frames */ |
799 |
|
static int nrfrms = 0; |
800 |
< |
double blurf; |
801 |
< |
int nblur = getblur(&blurf); |
800 |
> |
double mblurf, dblurf; |
801 |
> |
int nblur = getblur(&mblurf, &dblurf); |
802 |
|
char combuf[2048]; |
803 |
|
char fname[128]; |
804 |
|
register char *cp; |
817 |
|
cp = combuf; |
818 |
|
while (*cp) cp++; |
819 |
|
if (nblur) { |
820 |
< |
sprintf(cp, " -pm %.3f", blurf/nblur); |
820 |
> |
sprintf(cp, " -pm %.3f", mblurf/nblur); |
821 |
|
while (*cp) cp++; |
822 |
+ |
sprintf(cp, " -pd %.3f", dblurf/nblur); |
823 |
+ |
while (*cp) cp++; |
824 |
|
} |
825 |
|
if (nblur > 1 || vint(INTERP)) { |
826 |
|
sprintf(cp, " -z %s.zbf", fname); |
908 |
|
) |
909 |
|
{ |
910 |
|
static int iter = 0; |
911 |
< |
double blurf; |
912 |
< |
int nblur = getblur(&blurf); |
911 |
> |
double mblurf, dblurf; |
912 |
> |
int nblur = getblur(&mblurf, &dblurf); |
913 |
|
VIEW *vp = getview(frame); |
914 |
|
char *ep = getexp(frame); |
915 |
|
char fnbefore[128], fnafter[128], *fbase; |
968 |
|
if (usepinterp) { /* using pinterp */ |
969 |
|
if (rvr == 2 && recover(frseq[1])) /* recover after? */ |
970 |
|
return(1); |
971 |
< |
if (nblur > 1) { /* with pmblur */ |
971 |
> |
if (nblur > 1) { /* with pdmblur */ |
972 |
|
sprintf(fname0, "%s/vw0%c", vval(DIRECTORY), |
973 |
|
'a'+(iter%26)); |
974 |
|
sprintf(fname1, "%s/vw1%c", vval(DIRECTORY), |
995 |
|
putc('\n', fp); fclose(fp); |
996 |
|
} |
997 |
|
sprintf(combuf, |
998 |
< |
"(pmblur %.3f %d %s %s; rm -f %s %s) | pinterp -B -a", |
999 |
< |
blurf, nblur, |
998 |
> |
"(pmdblur %.3f %.3f %d %s %s; rm -f %s %s) | pinterp -B -a", |
999 |
> |
mblurf, dblurf, nblur, |
1000 |
|
fname0, fname1, fname0, fname1); |
1001 |
|
iter++; |
1002 |
|
} else /* no blurring */ |
1448 |
|
|
1449 |
|
|
1450 |
|
static int |
1451 |
< |
getblur(double *bf) /* get # blur samples (and fraction) */ |
1451 |
> |
getblur(double *mbf, double *dbf) /* get # blur samples (and fraction) */ |
1452 |
|
{ |
1453 |
< |
double blurf; |
1454 |
< |
int nblur; |
1453 |
> |
double mblurf, dblurf; |
1454 |
> |
int nmblur, ndblur; |
1455 |
|
char *s; |
1456 |
< |
|
1457 |
< |
if (!vdef(MBLUR)) { |
1458 |
< |
if (bf != NULL) |
1459 |
< |
*bf = 0.0; |
1460 |
< |
return(0); |
1461 |
< |
} |
1462 |
< |
blurf = atof(vval(MBLUR)); |
1463 |
< |
if (blurf < 0.0) |
1464 |
< |
blurf = 0.0; |
1465 |
< |
if (bf != NULL) |
1466 |
< |
*bf = blurf; |
1467 |
< |
if (blurf <= FTINY) |
1468 |
< |
return(0); |
1469 |
< |
s = sskip(vval(MBLUR)); |
1470 |
< |
if (!*s) |
1471 |
< |
return(DEF_NBLUR); |
1472 |
< |
nblur = atoi(s); |
1473 |
< |
if (nblur <= 0) |
1456 |
> |
/* get motion blur */ |
1457 |
> |
if (!vdef(MBLUR) || (mblurf = atof(vval(MBLUR))) < 0.0) |
1458 |
> |
mblurf = 0.0; |
1459 |
> |
if (mbf != NULL) |
1460 |
> |
*mbf = mblurf; |
1461 |
> |
if (mblurf <= FTINY) |
1462 |
> |
nmblur = 0; |
1463 |
> |
else if (!*(s = sskip(vval(MBLUR)))) |
1464 |
> |
nmblur = DEF_NBLUR; |
1465 |
> |
else if ((nmblur = atoi(s)) <= 0) |
1466 |
> |
nmblur = 1; |
1467 |
> |
/* get depth-of-field blur */ |
1468 |
> |
if (!vdef(DBLUR) || (dblurf = atof(vval(DBLUR))) < 0.0) |
1469 |
> |
dblurf = 0.0; |
1470 |
> |
if (dbf != NULL) |
1471 |
> |
*dbf = dblurf; |
1472 |
> |
if (dblurf <= FTINY) |
1473 |
> |
ndblur = 0; |
1474 |
> |
else if (!*(s = sskip(vval(DBLUR)))) |
1475 |
> |
ndblur = DEF_NBLUR; |
1476 |
> |
else if ((ndblur = atoi(s)) <= 0) |
1477 |
> |
ndblur = 1; |
1478 |
> |
if ((nmblur == 1) & (ndblur == 1)) |
1479 |
|
return(1); |
1480 |
< |
return(nblur); |
1480 |
> |
/* return combined samples */ |
1481 |
> |
return(nmblur + ndblur); |
1482 |
|
} |