ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ranimove.c
(Generate patch)

Comparing ray/src/util/ranimove.c (file contents):
Revision 3.9 by schorsch, Tue Oct 21 19:19:29 2003 UTC vs.
Revision 3.14 by greg, Wed Nov 3 05:05:21 2010 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char RCSid[] = "$Id";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  Radiance object animation program
# Line 62 | Line 62 | int            haveprio = 0;   /* high-level saliency specified */
62   int             gargc;          /* global argc for printargs */
63   char            **gargv;        /* global argv for printargs */
64  
65 + static void setdefaults(void);
66 + static void setmove(struct ObjMove      *om, char       *ms);
67 + static void setrendparams(char          *optf, char             *qval);
68 + static void getradfile(char     *rfargs);
69 + static void animate(void);
70 + static int countviews(void); /* XXX duplicated function */
71 + static char * getobjname(struct ObjMove *om);
72 + static char * getxf(struct ObjMove      *om, int        n);
73  
74 +
75   int
76 < main(argc, argv)
77 < int     argc;
78 < char    *argv[];
76 > main(
77 >        int     argc,
78 >        char    *argv[]
79 > )
80   {
81          int     explicate = 0;
82          char    *cfname;
# Line 153 | Line 163 | userr:
163   "Usage: %s [-n nprocs][-f beg,end][-t sec][-d jnd][-s][-w][-e] anim_file\n",
164                          progname);
165          quit(1);
166 +        return 1; /* pro forma return */
167   }
168  
169  
170   void
171 < eputs(s)                                /* put string to stderr */
172 < register char  *s;
171 > eputs(                          /* put string to stderr */
172 >        register char  *s
173 > )
174   {
175          static int  midline = 0;
176  
# Line 177 | Line 189 | register char  *s;
189  
190  
191   void
192 < setdefaults()                   /* set default values */
192 > quit(ec)                        /* make sure exit is called */
193 > int     ec;
194   {
195 +        if (ray_pnprocs > 0)    /* close children if any */
196 +                ray_pclose(0);          
197 +        exit(ec);
198 + }
199 +
200 +
201 + static void
202 + setdefaults(void)                       /* set default values */
203 + {
204          int     nviews;
205          int     decades;
206          char    buf[256];
# Line 253 | Line 275 | setdefaults()                  /* set default values */
275   }
276  
277  
278 < void
279 < setmove(om, ms)                 /* assign a move object from spec. */
280 < struct ObjMove  *om;
281 < char    *ms;
278 > static void
279 > setmove(                        /* assign a move object from spec. */
280 >        struct ObjMove  *om,
281 >        char    *ms
282 > )
283   {
284          char    parname[128];
285          char    *cp;
# Line 313 | Line 336 | badspec:
336   }
337  
338  
339 < void
340 < setrendparams(optf, qval)       /* set global rendering parameters */
341 < char            *optf;
342 < char            *qval;
339 > static void
340 > setrendparams(  /* set global rendering parameters */
341 >        char            *optf,
342 >        char            *qval
343 > )
344   {
345          char    *argv[1024];
346          char    **av = argv;
# Line 360 | Line 384 | char           *qval;
384   }
385  
386  
387 < void
388 < getradfile(rfargs)              /* run rad and get needed variables */
389 < char    *rfargs;
387 > static void
388 > getradfile(             /* run rad and get needed variables */
389 >        char    *rfargs
390 > )
391   {
392          static short    mvar[] = {OCONV,OCTREEF,RESOLUTION,EXPOSURE,-1};
393          char    combuf[256];
394          register int    i;
395          register char   *cp;
396 <        char    *pippt;
396 >        char    *pippt = NULL;
397                                          /* create rad command */
398          strcpy(lorendoptf, "ranim0.opt");
399          sprintf(combuf,
# Line 411 | Line 436 | char   *rfargs;
436   }
437  
438  
439 < void
440 < animate()                       /* run through animation */
439 > static void
440 > animate(void)                   /* run through animation */
441   {
442          int     rpass;
443  
# Line 443 | Line 468 | animate()                      /* run through animation */
468   }
469  
470  
471 < VIEW *
472 < getview(n)                      /* get view number n */
473 < int     n;
471 > extern VIEW *
472 > getview(                        /* get view number n */
473 >        int     n
474 > )
475   {
476          static FILE     *viewfp = NULL;         /* view file pointer */
477          static int      viewnum = 0;            /* current view number */
# Line 493 | Line 519 | int    n;
519   }
520  
521  
522 < int
523 < countviews()                    /* count views in view file */
522 > static int
523 > countviews(void)                        /* count views in view file */
524   {
525          int     n;
526  
# Line 506 | Line 532 | countviews()                   /* count views in view file */
532   }
533  
534  
535 < char *
536 < getexp(n)                       /* get exposure for nth frame */
537 < int     n;
535 > extern char *
536 > getexp(                 /* get exposure for nth frame */
537 >        int     n
538 > )
539   {
540          extern char     *fskip();
541          static char     expval[32];
# Line 560 | Line 587 | formerr:
587          sprintf(errmsg, "%s: exposure format error on line %d",
588                          vval(EXPOSURE), curfrm);
589          error(USER, errmsg);
590 +        return NULL; /* pro forma return */
591   }
592  
593  
594 < double
595 < expspec_val(s)                  /* get exposure value from spec. */
596 < char    *s;
594 > extern double
595 > expspec_val(                    /* get exposure value from spec. */
596 >        char    *s
597 > )
598   {
599          double  expval;
600  
# Line 579 | Line 608 | char   *s;
608   }
609  
610  
611 < char *
612 < getoctspec(n)                   /* get octree for the given frame */
613 < int     n;
611 > extern char *
612 > getoctspec(                     /* get octree for the given frame */
613 >        int     n
614 > )
615   {
616          static char     combuf[1024];
617 <        int             cfm = 0;
617 >        static int      cfm = 0;
618          int     uses_inline;
619          FILE    *fp;
620          int     i;
621                                          /* is octree static? */
622          if (!vdef(MOVE))
623                  return(vval(OCTREEF));
624 <                                        /* done already */
624 >                                        /* done already? */
625          if (n == cfm)
626                  return(combuf);
627                                          /* else create object file */
628 <        strcpy(objtmpf, "movinobj.rad");
599 <        fp = fopen(objtmpf, "w");
628 >        fp = fopen(mktemp(strcpy(objtmpf, TEMPLATE)), "w");
629          if (fp == NULL) {
630                  sprintf(errmsg, "cannot write to moving objects file '%s'",
631                                  objtmpf);
# Line 627 | Line 656 | int    n;
656                                  vdef(OCONV) ? vval(OCONV) : "",
657                                  vval(OCTREEF), objtmpf);
658          else
659 <                sprintf(combuf, "!xform -f %s | oconv -f -i '%s' -",
660 <                                objtmpf, vval(OCTREEF));
659 >                sprintf(combuf, "!xform -f %s | oconv %s -f -i '%s' -",
660 >                                objtmpf, vdef(OCONV) ? vval(OCONV) : "",
661 >                                vval(OCTREEF));
662          return(combuf);
663   }
664  
665  
666 < char *
667 < getobjname(om)                  /* get fully qualified object name */
668 < register struct ObjMove *om;
666 > static char *
667 > getobjname(                     /* get fully qualified object name */
668 >        register struct ObjMove *om
669 > )
670   {
671          static char     objName[512];
672          register char   *cp = objName;
# Line 651 | Line 682 | register struct ObjMove        *om;
682   }
683  
684  
685 < char *
686 < getxf(om, n)                    /* get total transform for object */
687 < register struct ObjMove *om;
688 < int     n;
685 > static char *
686 > getxf(                  /* get total transform for object */
687 >        register struct ObjMove *om,
688 >        int     n
689 > )
690   {
691          static char     xfsbuf[4096];
692          char            *xfp;
# Line 773 | Line 805 | int    n;
805   }
806  
807  
808 < int
809 < getmove(obj)                            /* find matching move object */
810 < OBJECT  obj;
808 > extern int
809 > getmove(                                /* find matching move object */
810 >        OBJECT  obj
811 > )
812   {
813          static int      lasti;
814          static OBJECT   lasto = OVOID;
# Line 806 | Line 839 | OBJECT obj;
839   }
840  
841  
842 < double
843 < obj_prio(obj)                   /* return priority for object */
844 < OBJECT  obj;
842 > extern double
843 > obj_prio(                       /* return priority for object */
844 >        OBJECT  obj
845 > )
846   {
847          int     moi;
848          
# Line 818 | Line 852 | OBJECT obj;
852   }
853  
854  
855 < double
856 < getTime()                       /* get current time (CPU or real) */
855 > extern double
856 > getTime(void)                   /* get current time (CPU or real) */
857   {
858          struct timeval  time_now;
859                                          /* return CPU time if one process */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines