1 |
|
#ifndef lint |
2 |
< |
static const char RCSid[] = "$Id$"; |
2 |
> |
static const char RCSid[] = "$Id"; |
3 |
|
#endif |
4 |
|
/* |
5 |
|
* Radiance object animation program |
11 |
|
|
12 |
|
#include "copyright.h" |
13 |
|
|
14 |
< |
#include "ranimove.h" |
15 |
< |
#include <sys/time.h> |
14 |
> |
#include <time.h> |
15 |
> |
#ifdef _WIN32 |
16 |
> |
#include <winsock.h> /* struct timeval. XXX find a replacement? */ |
17 |
> |
#else |
18 |
> |
#include <sys/time.h> |
19 |
> |
#endif |
20 |
|
#include <ctype.h> |
21 |
+ |
#include <string.h> |
22 |
|
|
23 |
+ |
#include "paths.h" |
24 |
+ |
#include "ranimove.h" |
25 |
+ |
|
26 |
|
int NVARS = NV_INIT; /* total number of variables */ |
27 |
|
|
28 |
|
VARIABLE vv[] = VV_INIT; /* variable-value pairs */ |
99 |
|
case 'f': /* frame range */ |
100 |
|
switch (sscanf(argv[++i], "%d,%d", &fbeg, &fend)) { |
101 |
|
case 2: |
102 |
< |
if ((fbeg <= 0 | fend < fbeg)) |
102 |
> |
if ((fbeg <= 0) | (fend < fbeg)) |
103 |
|
goto userr; |
104 |
|
break; |
105 |
|
case 1: |
143 |
|
/* all done */ |
144 |
|
if (lorendoptf[0]) |
145 |
|
unlink(lorendoptf); |
146 |
< |
if (hirendoptf[0]) |
146 |
> |
if (hirendoptf[0] && strcmp(hirendoptf, lorendoptf)) |
147 |
|
unlink(hirendoptf); |
148 |
|
if (objtmpf[0]) |
149 |
|
unlink(objtmpf); |
249 |
|
setrendparams(lorendoptf, vval(LOWQ)); |
250 |
|
ray_save(&lorendparams); |
251 |
|
curparams = &lorendparams; |
252 |
< |
twolevels = bcmp(&lorendparams, &hirendparams, sizeof(RAYPARAMS)); |
252 |
> |
twolevels = memcmp(&lorendparams, &hirendparams, sizeof(RAYPARAMS)); |
253 |
|
} |
254 |
|
|
255 |
|
|
301 |
|
if (isflt(om->prio_file)) { |
302 |
|
om->prio = atof(om->prio_file); |
303 |
|
om->prio_file[0] = '\0'; |
304 |
< |
haveprio |= (om->prio < 0.95 | om->prio > 1.05); |
304 |
> |
haveprio |= ((om->prio < 0.95) | (om->prio > 1.05)); |
305 |
|
} else |
306 |
|
haveprio = 1; |
307 |
|
} else |
336 |
|
if (qval != NULL && qval[0] == '-') |
337 |
|
ac += wordstring(av+ac, qval); |
338 |
|
|
339 |
< |
/* start with default parameters */ |
340 |
< |
ray_defaults(NULL); |
339 |
> |
/* restore default parameters */ |
340 |
> |
ray_restore(NULL); |
341 |
|
/* set what we have */ |
342 |
|
for (i = 0; i < ac; i++) { |
343 |
|
while ((rval = expandarg(&ac, &av, i)) > 0) |
351 |
|
continue; |
352 |
|
} |
353 |
|
rval = getrenderopt(ac-i, av+i); |
354 |
< |
if (rval >= 0) { |
355 |
< |
i += rval; |
356 |
< |
continue; |
354 |
> |
if (rval < 0) { |
355 |
> |
sprintf(errmsg, "bad render option at '%s'", av[i]); |
356 |
> |
error(USER, errmsg); |
357 |
|
} |
358 |
< |
sprintf(errmsg, "bad render option at '%s'", av[i]); |
351 |
< |
error(USER, errmsg); |
358 |
> |
i += rval; |
359 |
|
} |
360 |
|
} |
361 |
|
|
389 |
|
pippt = NULL; |
390 |
|
} |
391 |
|
if (pippt != NULL) |
392 |
< |
strcpy(pippt, "> /dev/null"); /* nothing to match */ |
392 |
> |
strcpy(pippt, "> " NULL_DEVICE); /* nothing to match */ |
393 |
|
else { |
394 |
|
strcpy(cp, ")[ \t]*=' > ranimove.var"); |
395 |
|
cp += 11; /* point to file name */ |
457 |
|
fclose(viewfp); |
458 |
|
viewfp = NULL; |
459 |
|
viewnum = 0; |
460 |
< |
copystruct(&curview, &stdview); |
460 |
> |
curview = stdview; |
461 |
|
} |
462 |
|
return(NULL); |
463 |
|
} |
473 |
|
perror(vval(VIEWFILE)); |
474 |
|
quit(1); |
475 |
|
} |
476 |
< |
copystruct(&curview, &stdview); |
476 |
> |
curview = stdview; |
477 |
|
viewnum = 0; |
478 |
|
} |
479 |
|
if (n < 0) { /* get next view */ |
573 |
|
return(1.0); |
574 |
|
|
575 |
|
expval = atof(s); |
576 |
< |
if ((s[0] == '+' | s[0] == '-')) |
576 |
> |
if ((s[0] == '+') | (s[0] == '-')) |
577 |
|
return(pow(2.0, expval)); |
578 |
|
return(expval); |
579 |
|
} |
762 |
|
om->cprio = om->prio; |
763 |
|
} |
764 |
|
/* XXX bxfm relies on call order */ |
765 |
< |
if (framestep) |
765 |
> |
if (framestep) { |
766 |
|
if (invmat4(om->bxfm, om->cxfm)) |
767 |
|
multmat4(om->bxfm, om->bxfm, oxf.xfm); |
768 |
|
else |
769 |
|
setident4(om->bxfm); |
770 |
+ |
} |
771 |
|
/* all done */ |
772 |
|
return(xfp); |
773 |
|
} |
793 |
|
objnm = obj_move[i].name; |
794 |
|
len = strlen(objnm); |
795 |
|
if (!strncmp(onm, objnm, len)) { |
796 |
< |
if ((obj_move[i].parent < 0 & onm[len] == '.')) |
796 |
> |
if ((obj_move[i].parent < 0) & (onm[len] == '.')) |
797 |
|
break; |
798 |
|
objnm = getobjname(&obj_move[i]) + len; |
799 |
|
len2 = strlen(objnm); |