772 |
|
d = ambval(); |
773 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
774 |
|
op += strlen(op); |
775 |
< |
op = addarg(op, "-lr 6 -lw .01"); |
775 |
> |
op = addarg(op, "-lr 6 -lw .003"); |
776 |
|
} |
777 |
|
|
778 |
|
|
850 |
|
d = ambval(); |
851 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
852 |
|
op += strlen(op); |
853 |
< |
op = addarg(op, "-lr 8 -lw .002"); |
853 |
> |
op = addarg(op, "-lr 8 -lw 1e-4"); |
854 |
|
} |
855 |
|
|
856 |
|
|
904 |
|
op = addarg(op, "-ds .1 -dj .9"); |
905 |
|
else |
906 |
|
op = addarg(op, "-ds .2"); |
907 |
< |
op = addarg(op, "-dt .05 -dc .75 -dr 3 -ss 50 -st .01"); |
907 |
> |
op = addarg(op, "-dt .05 -dc .75 -dr 3 -ss 16 -st .01"); |
908 |
|
sprintf(op, " -ab %d", overture=vint(INDIRECT)+1); |
909 |
|
op += strlen(op); |
910 |
|
if (vdef(AMBFILE)) { |
926 |
|
d = ambval(); |
927 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
928 |
|
op += strlen(op); |
929 |
< |
op = addarg(op, "-lr 12 -lw .0005"); |
929 |
> |
op = addarg(op, "-lr 12 -lw 1e-5"); |
930 |
|
} |
931 |
|
|
932 |
|
|
1254 |
|
} |
1255 |
|
|
1256 |
|
|
1257 |
+ |
static int |
1258 |
+ |
syncf_done( /* check if an rpiece sync file is complete */ |
1259 |
+ |
char *sfname |
1260 |
+ |
) |
1261 |
+ |
{ |
1262 |
+ |
FILE *fp = fopen(sfname, "r"); |
1263 |
+ |
int todo = 1; |
1264 |
+ |
int x, y; |
1265 |
+ |
|
1266 |
+ |
if (fp == NULL) |
1267 |
+ |
return(0); |
1268 |
+ |
if (fscanf(fp, "%d %d", &x, &y) != 2) |
1269 |
+ |
goto checked; |
1270 |
+ |
todo = x*y; /* total number of tiles */ |
1271 |
+ |
if (fscanf(fp, "%d %d", &x, &y) != 2 || (x != 0) | (y != 0)) |
1272 |
+ |
goto checked; |
1273 |
+ |
/* XXX assume no redundant tiles */ |
1274 |
+ |
while (fscanf(fp, "%d %d", &x, &y) == 2) |
1275 |
+ |
if (!--todo) |
1276 |
+ |
break; |
1277 |
+ |
checked: |
1278 |
+ |
fclose(fp); |
1279 |
+ |
return(!todo); |
1280 |
+ |
} |
1281 |
+ |
|
1282 |
+ |
|
1283 |
|
static void |
1284 |
|
rpict( /* run rpict and pfilt for each view */ |
1285 |
|
char *opts, |
1287 |
|
) |
1288 |
|
{ |
1289 |
|
#define do_rpiece (sfile[0]!='\0') |
1290 |
< |
char combuf[4*PATH_MAX+512]; |
1290 |
> |
char combuf[5*PATH_MAX+512]; |
1291 |
|
char rawfile[PATH_MAX], picfile[PATH_MAX]; |
1292 |
|
char zopt[PATH_MAX+4], rep[PATH_MAX+16], res[32]; |
1293 |
< |
char rppopt[128], sfile[64], *pfile = NULL; |
1293 |
> |
char rppopt[32], sfile[PATH_MAX], *pfile = NULL; |
1294 |
|
char pfopts[128]; |
1295 |
|
char vs[32], *vw; |
1296 |
|
int vn, mult; |
1297 |
|
FILE *fp; |
1298 |
|
time_t rfdt, pfdt; |
1299 |
+ |
int xres, yres; |
1300 |
+ |
double aspect; |
1301 |
+ |
int n; |
1302 |
|
/* get pfilt options */ |
1303 |
|
pfiltopts(pfopts); |
1304 |
|
/* get resolution, reporting */ |
1313 |
|
mult = 3; |
1314 |
|
break; |
1315 |
|
} |
1316 |
< |
{ |
1317 |
< |
int xres, yres; |
1318 |
< |
double aspect; |
1319 |
< |
int n; |
1320 |
< |
n = sscanf(vval(RESOLUTION), "%d %d %lf", &xres, &yres, &aspect); |
1321 |
< |
if (n == 3) |
1322 |
< |
sprintf(res, "-x %d -y %d -pa %.3f", |
1323 |
< |
mult*xres, mult*yres, aspect); |
1324 |
< |
else if (n) { |
1325 |
< |
if (n == 1) yres = xres; |
1297 |
< |
sprintf(res, "-x %d -y %d", mult*xres, mult*yres); |
1298 |
< |
} else |
1299 |
< |
badvalue(RESOLUTION); |
1300 |
< |
} |
1316 |
> |
n = sscanf(vval(RESOLUTION), "%d %d %lf", &xres, &yres, &aspect); |
1317 |
> |
if (n == 3) |
1318 |
> |
sprintf(res, "-x %d -y %d -pa %.3f", |
1319 |
> |
mult*xres, mult*yres, aspect); |
1320 |
> |
else if (n) { |
1321 |
> |
aspect = 1.; |
1322 |
> |
if (n == 1) yres = xres; |
1323 |
> |
sprintf(res, "-x %d -y %d", mult*xres, mult*yres); |
1324 |
> |
} else |
1325 |
> |
badvalue(RESOLUTION); |
1326 |
|
rep[0] = '\0'; |
1327 |
|
if (vdef(REPORT)) { |
1328 |
|
double minutes; |
1304 |
– |
int n; |
1329 |
|
n = sscanf(vval(REPORT), "%lf %s", &minutes, rawfile); |
1330 |
|
if (n == 2) |
1331 |
|
sprintf(rep, " -t %d -e %s", (int)(minutes*60), rawfile); |
1340 |
|
getview(0, vs) != NULL) { |
1341 |
|
if (!strcmp(c_rpict, DEF_RPICT_PATH) && |
1342 |
|
getview(1, NULL) == NULL) { |
1343 |
< |
sprintf(sfile, "rpsync_%s.txt", vs); |
1343 |
> |
sprintf(sfile, "%s_%s_rpsync.txt", |
1344 |
> |
vdef(RAWFILE) ? vval(RAWFILE) : vval(PICTURE), |
1345 |
> |
vs); |
1346 |
|
strcpy(rppopt, "-PP pfXXXXXX"); |
1347 |
|
} else { |
1348 |
|
strcpy(rppopt, "-S 1 -PP pfXXXXXX"); |
1385 |
|
if (do_rpiece) { |
1386 |
|
if (rfdt < oct1date || !fdate(sfile)) { |
1387 |
|
int xdiv = 8+nprocs/3, ydiv = 8+nprocs/3; |
1388 |
< |
rfdt = 0; /* start fresh */ |
1388 |
> |
if (rfdt >= oct1date) { |
1389 |
> |
fprintf(stderr, |
1390 |
> |
"%s: partial output not created with rpiece\n", rawfile); |
1391 |
> |
quit(1); |
1392 |
> |
} |
1393 |
> |
if (rfdt) { /* start fresh */ |
1394 |
> |
rmfile(rawfile); |
1395 |
> |
rfdt = 0; |
1396 |
> |
} |
1397 |
|
if (!silent) |
1398 |
|
printf("\techo %d %d > %s\n", |
1399 |
|
xdiv, ydiv, sfile); |
1430 |
|
} else { |
1431 |
|
if (overture) { /* run overture calculation */ |
1432 |
|
sprintf(combuf, |
1433 |
< |
"%s%s %s%s -x 64 -y 64 -ps 1 %s > %s", |
1433 |
> |
"%s%s %s%s -x 64 -y 64 -ps 1 %s > %s", |
1434 |
|
c_rpict, rep, vw, opts, |
1435 |
|
oct1name, overfile); |
1436 |
< |
if (do_rpiece) |
1437 |
< |
while (next_process(1)) |
1438 |
< |
sleep(5); |
1405 |
< |
if (runcom(combuf)) { |
1406 |
< |
fprintf(stderr, |
1436 |
> |
if (!do_rpiece || !next_process(0)) { |
1437 |
> |
if (runcom(combuf)) { |
1438 |
> |
fprintf(stderr, |
1439 |
|
"%s: error in overture for view %s\n", |
1440 |
< |
progname, vs); |
1441 |
< |
quit(1); |
1442 |
< |
} |
1411 |
< |
if (do_rpiece) { |
1412 |
< |
finish_process(); |
1413 |
< |
wait_process(1); |
1414 |
< |
} |
1440 |
> |
progname, vs); |
1441 |
> |
quit(1); |
1442 |
> |
} |
1443 |
|
#ifndef NULL_DEVICE |
1444 |
< |
rmfile(overfile); |
1444 |
> |
rmfile(overfile); |
1445 |
|
#endif |
1446 |
+ |
} else if (do_rpiece) |
1447 |
+ |
sleep(20); |
1448 |
|
} |
1449 |
|
if (do_rpiece) { |
1450 |
|
sprintf(combuf, "%s -F %s %s%s %s %s%s%s -o %s %s", |
1476 |
|
if (do_rpiece) { /* need to finish raw, first */ |
1477 |
|
finish_process(); |
1478 |
|
wait_process(1); |
1479 |
< |
/* XXX should check sync file to see if really done? */ |
1479 |
> |
if (!syncf_done(sfile)) { |
1480 |
> |
fprintf(stderr, |
1481 |
> |
"%s: rpiece did not complete rendering of view %s\n", |
1482 |
> |
progname, vs); |
1483 |
> |
quit(1); |
1484 |
> |
} |
1485 |
|
} |
1486 |
|
if (!vdef(RAWFILE) || strcmp(vval(RAWFILE),vval(PICTURE))) { |
1487 |
|
/* build pfilt command */ |
1488 |
< |
if (mult > 1) |
1488 |
> |
if (do_rpiece) |
1489 |
> |
sprintf(combuf, |
1490 |
> |
"%s%s -x %d -y %d -p %.3f %s > %s", |
1491 |
> |
c_pfilt, pfopts, xres, yres, aspect, |
1492 |
> |
rawfile, picfile); |
1493 |
> |
else if (mult > 1) |
1494 |
|
sprintf(combuf, "%s%s -x /%d -y /%d %s > %s", |
1495 |
|
c_pfilt, pfopts, mult, mult, |
1496 |
|
rawfile, picfile); |
1610 |
|
child_pid = fork(); /* split process */ |
1611 |
|
if (child_pid == 0) { /* we're the child */ |
1612 |
|
children_running = -1; |
1613 |
+ |
nprocs = 1; |
1614 |
|
return(0); |
1615 |
|
} |
1616 |
|
if (child_pid > 0) { /* we're the parent */ |