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.13 by greg, Sat Dec 12 19:01:00 2009 UTC vs.
Revision 3.16 by schorsch, Sun Mar 6 01:13:18 2016 UTC

# Line 12 | Line 12 | static const char RCSid[] = "$Id$";
12   #include "copyright.h"
13  
14   #include <time.h>
15 < #ifdef _WIN32
15 > #if defined(_WIN32) || defined(_WIN64)
16    #include <winsock.h> /* struct timeval. XXX find a replacement? */
17   #else
18    #include <sys/time.h>
# Line 20 | Line 20 | static const char RCSid[] = "$Id$";
20   #include <ctype.h>
21   #include <string.h>
22  
23 + #include "platform.h"
24   #include "paths.h"
25   #include "ranimove.h"
26  
# Line 614 | Line 615 | getoctspec(                    /* get octree for the given frame */
615   )
616   {
617          static char     combuf[1024];
618 <        int             cfm = 0;
618 >        static int      cfm = 0;
619          int     uses_inline;
620          FILE    *fp;
621          int     i;
622                                          /* is octree static? */
623          if (!vdef(MOVE))
624                  return(vval(OCTREEF));
625 <                                        /* done already */
625 >                                        /* done already? */
626          if (n == cfm)
627                  return(combuf);
628                                          /* else create object file */
629 <        strcpy(objtmpf, "movinobj.rad");
629 <        fp = fopen(objtmpf, "w");
629 >        fp = fopen(mktemp(strcpy(objtmpf, TEMPLATE)), "w");
630          if (fp == NULL) {
631                  sprintf(errmsg, "cannot write to moving objects file '%s'",
632                                  objtmpf);
# Line 657 | Line 657 | getoctspec(                    /* get octree for the given frame */
657                                  vdef(OCONV) ? vval(OCONV) : "",
658                                  vval(OCTREEF), objtmpf);
659          else
660 <                sprintf(combuf, "!xform -f %s | oconv -f -i '%s' -",
661 <                                objtmpf, vval(OCTREEF));
660 >                sprintf(combuf, "!xform -f %s | oconv %s -f -i '%s' -",
661 >                                objtmpf, vdef(OCONV) ? vval(OCONV) : "",
662 >                                vval(OCTREEF));
663          return(combuf);
664   }
665  
# Line 851 | Line 852 | obj_prio(                      /* return priority for object */
852          return(obj_move[moi].cprio);
853   }
854  
855 +
856 + #if defined(_WIN32) || defined(_WIN64)
857 +                                /* replacement function for Windoze */
858 + static int
859 + gettimeofday(struct timeval *tp, void *dummy)
860 + {
861 +    FILETIME        ft;
862 +    LARGE_INTEGER   li;
863 +    __int64         t;
864 +
865 +        SYSTEMTIME              st;
866 +        FILETIME                ft2;
867 +        LARGE_INTEGER   li2;
868 +        __int64                 t2;
869 +
870 +        st.wYear = 1970;
871 +        st.wHour = 0;
872 +        st.wMinute = 0;
873 +        st.wSecond = 0;
874 +        st.wMilliseconds = 1;
875 +
876 +        SystemTimeToFileTime(&st, &ft2);
877 +        li2.LowPart = ft2.dwLowDateTime;
878 +        li2.HighPart = ft2.dwHighDateTime;
879 +        t2 = li2.QuadPart;
880 +
881 +    GetSystemTimeAsFileTime(&ft);
882 +    li.LowPart  = ft.dwLowDateTime;
883 +    li.HighPart = ft.dwHighDateTime;
884 +    t  = li.QuadPart;      
885 +    t -= t2; // From 1970
886 +    t /= 10; // In microseconds
887 +    tp->tv_sec  = (long)(t / 1000000);
888 +    tp->tv_usec = (long)(t % 1000000);
889 +    return 0;
890 + }
891 +
892 + #endif
893  
894   extern double
895   getTime(void)                   /* get current time (CPU or real) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines