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

Comparing ray/src/util/ranimate.c (file contents):
Revision 2.24 by gwlarson, Thu Feb 26 10:27:45 1998 UTC vs.
Revision 2.25 by gwlarson, Tue Mar 3 11:44:46 1998 UTC

# Line 115 | Line 115 | struct pslot   *findpslot();
115   PSERVER *lastpserver;           /* last process server with error */
116  
117   VIEW    *getview();
118 < char    *getexp();
118 > char    *getexp(), *dirfile();
119  
120   extern time_t   fdate(), time();
121  
# Line 536 | Line 536 | animate()                      /* run animation */
536                  quit(1);
537          }
538                                          /* initialize archive argument list */
539 <        i = 16;
540 <        if (vdef(ARCHIVE) && strlen(vval(ARCHIVE)) > i)
541 <                i = strlen(vval(ARCHIVE));
539 >        i = vdef(ARCHIVE) ? strlen(vval(ARCHIVE))+132 : 132;
540          arcnext = arcfirst = arcargs + i;
541                                          /* initialize status file */
542          if (astat.rnext == 0)
# Line 642 | Line 640 | filterframes()                         /* catch up with filtering */
640  
641   transferframes()                        /* catch up with picture transfers */
642   {
643 <        char    combuf[10240];
643 >        char    combuf[10240], *fbase;
644          register char   *cp;
645          register int    i;
646  
# Line 653 | Line 651 | transferframes()                       /* catch up with picture transfers
651                  putastat();             /* update status */
652                  return;
653          }
654 <        strcpy(combuf, vval(TRANSFER)); /* start transfer command */
655 <        cp = combuf + strlen(combuf);
654 >        strcpy(combuf, "cd ");          /* start transfer command */
655 >        fbase = dirfile(cp = combuf+3, vval(BASENAME));
656 >        if (*cp) {
657 >                while (*++cp) ;
658 >                *cp++ = ';'; *cp++ = ' ';
659 >        } else
660 >                cp = combuf;
661 >        strcpy(cp, vval(TRANSFER));
662 >        while (*cp) cp++;
663                                          /* make argument list */
664          for (i = astat.tnext; i < astat.fnext; i++) {
665                  *cp++ = ' ';
666 <                sprintf(cp, vval(BASENAME), i);
666 >                sprintf(cp, fbase, i);
667                  while (*cp) cp++;
668                  strcpy(cp, ".pic");
669                  cp += 4;
# Line 799 | Line 804 | archive()                      /* archive and remove renderings */
804   {
805   #define RMCOML  (sizeof(rmcom)-1)
806          static char     rmcom[] = "rm -f";
807 <        register int    i;
807 >        char    basedir[128];
808 >        int     dlen, alen;
809 >        register int    j;
810  
811          if (arcnext == arcfirst)
812                  return;                         /* nothing to do */
813 +        dirfile(basedir, vval(BASENAME));
814 +        dlen = strlen(basedir);
815          if (vdef(ARCHIVE)) {                    /* run archive command */
816 <                i = strlen(vval(ARCHIVE));
817 <                strncpy(arcfirst-i, vval(ARCHIVE), i);
818 <                if (runcom(arcfirst-i)) {
816 >                alen = strlen(vval(ARCHIVE));
817 >                if (dlen) {
818 >                        j = alen + dlen + 5;
819 >                        strncpy(arcfirst-j, "cd ", 3);
820 >                        strncpy(arcfirst-j+3, basedir, dlen);
821 >                        (arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' ';
822 >                } else
823 >                        j = alen;
824 >                strncpy(arcfirst-alen, vval(ARCHIVE), alen);
825 >                if (runcom(arcfirst-j)) {
826                          fprintf(stderr, "%s: error running archive command\n",
827                                          progname);
828                          quit(1);
829                  }
830          }
831 +        if (dlen) {
832 +                j = RMCOML + dlen + 5;
833 +                strncpy(arcfirst-j, "cd ", 3);
834 +                strncpy(arcfirst-j+3, basedir, dlen);
835 +                (arcfirst-j)[dlen+3] = ';'; (arcfirst-j)[dlen+4] = ' ';
836 +        } else
837 +                j = RMCOML;
838                                                  /* run remove command */
839          strncpy(arcfirst-RMCOML, rmcom, RMCOML);
840 <        runcom(arcfirst-RMCOML);
840 >        runcom(arcfirst-j);
841          arcnext = arcfirst;                     /* reset argument list */
842   #undef RMCOML
843   }
# Line 829 | Line 852 | int    rvr;
852   {
853          extern int      frecover();
854          static int      iter = 0;
855 <        char    fnbefore[128], fnafter[128];
855 >        char    fnbefore[128], fnafter[128], *fbase;
856          char    combuf[1024], fname0[128], fname1[128];
857          int     usepinterp, usepfilt, nora_rgbe;
858          int     frseq[2];
# Line 843 | Line 866 | int    rvr;
866                                                  /* compute rendered views */
867          frseq[0] = frame - ((frame-1) % (vint(INTERP)+1));
868          frseq[1] = frseq[0] + vint(INTERP) + 1;
869 +        fbase = dirfile(NULL, vval(BASENAME));
870          if (frseq[1] > vint(END))
871                  frseq[1] = vint(END);
872          if (frseq[1] == frame) {                        /* pfilt only */
# Line 852 | Line 876 | int    rvr;
876          } else if (frseq[0] == frame) {         /* no interpolation needed */
877                  if (!rvr && frame > 1+vint(INTERP)) {   /* archive previous */
878                          *arcnext++ = ' ';
879 <                        sprintf(arcnext, vval(BASENAME), frame-vint(INTERP)-1);
879 >                        sprintf(arcnext, fbase, frame-vint(INTERP)-1);
880                          while (*arcnext) arcnext++;
881                          strcpy(arcnext, ".unf");
882                          arcnext += 4;
883                          if (usepinterp || vint(INTERP)) {       /* and Z-buf */
884                                  *arcnext++ = ' ';
885 <                                sprintf(arcnext, vval(BASENAME),
862 <                                                frame-vint(INTERP)-1);
885 >                                sprintf(arcnext, fbase, frame-vint(INTERP)-1);
886                                  while (*arcnext) arcnext++;
887                                  strcpy(arcnext, ".zbf");
888                                  arcnext += 4;
# Line 880 | Line 903 | int    rvr;
903                  if (rvr == 2 && recover(frseq[1]))      /* recover after? */
904                          return(1);
905                  if (atoi(vval(MBLUR))) {
883                        FILE    *fp;            /* motion blurring */
906                          sprintf(fname0, "%s/vw0%c", vval(DIRECTORY),
907                                          'a'+(iter%26));
886                        if ((fp = fopen(fname0, "w")) == NULL) {
887                                perror(fname0); quit(1);
888                        }
889                        fputs(VIEWSTR, fp);
890                        fprintview(vp, fp);
891                        putc('\n', fp); fclose(fp);
892                        if ((vp = getview(frame+1)) == NULL) {
893                                fprintf(stderr,
894                        "%s: unexpected error reading view for frame %d\n",
895                                                progname, frame+1);
896                                quit(1);
897                        }
908                          sprintf(fname1, "%s/vw1%c", vval(DIRECTORY),
909                                          'a'+(iter%26));
910 <                        if ((fp = fopen(fname1, "w")) == NULL) {
911 <                                perror(fname1); quit(1);
910 >                        if (!noaction) {
911 >                                FILE    *fp;            /* motion blurring */
912 >                                if ((fp = fopen(fname0, "w")) == NULL) {
913 >                                        perror(fname0); quit(1);
914 >                                }
915 >                                fputs(VIEWSTR, fp);
916 >                                fprintview(vp, fp);
917 >                                putc('\n', fp); fclose(fp);
918 >                                if ((vp = getview(frame+1)) == NULL) {
919 >                                        fprintf(stderr,
920 >                        "%s: unexpected error reading view for frame %d\n",
921 >                                                        progname, frame+1);
922 >                                        quit(1);
923 >                                }
924 >                                if ((fp = fopen(fname1, "w")) == NULL) {
925 >                                        perror(fname1); quit(1);
926 >                                }
927 >                                fputs(VIEWSTR, fp);
928 >                                fprintview(vp, fp);
929 >                                putc('\n', fp); fclose(fp);
930                          }
903                        fputs(VIEWSTR, fp);
904                        fprintview(vp, fp);
905                        putc('\n', fp); fclose(fp);
931                          sprintf(combuf,
932                          "(pmblur %s %d %s %s; rm -f %s %s) | pinterp -B",
933                          *sskip(vval(MBLUR)) ? sskip2(vval(MBLUR),1) : "1",
# Line 1326 | Line 1351 | int    vc;
1351          fprintf(stderr, "%s: bad value for variable '%s'\n",
1352                          progname, vnam(vc));
1353          quit(1);
1354 + }
1355 +
1356 +
1357 + char *
1358 + dirfile(df, path)               /* separate path into directory and file */
1359 + char    *df;
1360 + register char   *path;
1361 + {
1362 +        register int    i;
1363 +        int     psep;
1364 +
1365 +        for (i = 0, psep = -1; path[i]; i++)
1366 +                if (path[i] == '/')
1367 +                        psep = i;
1368 +        if (df != NULL)
1369 +                if (psep == 0) {
1370 +                        df[0] = '/';
1371 +                        df[1] = '\0';
1372 +                } else if (psep > 0) {
1373 +                        strncpy(df, path, psep);
1374 +                        df[psep] = '\0';
1375 +                } else
1376 +                        df[0] = '\0';
1377 +        return(path+psep+1);
1378   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines