188 |
|
} |
189 |
|
|
190 |
|
|
191 |
+ |
void |
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 |
|
{ |
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"); |
619 |
< |
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); |
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 |
|
|
851 |
|
return(obj_move[moi].cprio); |
852 |
|
} |
853 |
|
|
854 |
+ |
|
855 |
+ |
#ifdef _WIN32 |
856 |
+ |
/* replacement function for Windoze */ |
857 |
+ |
static int |
858 |
+ |
gettimeofday(struct timeval *tp, void *dummy) |
859 |
+ |
{ |
860 |
+ |
FILETIME ft; |
861 |
+ |
LARGE_INTEGER li; |
862 |
+ |
__int64 t; |
863 |
+ |
|
864 |
+ |
SYSTEMTIME st; |
865 |
+ |
FILETIME ft2; |
866 |
+ |
LARGE_INTEGER li2; |
867 |
+ |
__int64 t2; |
868 |
+ |
|
869 |
+ |
st.wYear = 1970; |
870 |
+ |
st.wHour = 0; |
871 |
+ |
st.wMinute = 0; |
872 |
+ |
st.wSecond = 0; |
873 |
+ |
st.wMilliseconds = 1; |
874 |
+ |
|
875 |
+ |
SystemTimeToFileTime(&st, &ft2); |
876 |
+ |
li2.LowPart = ft2.dwLowDateTime; |
877 |
+ |
li2.HighPart = ft2.dwHighDateTime; |
878 |
+ |
t2 = li2.QuadPart; |
879 |
+ |
|
880 |
+ |
GetSystemTimeAsFileTime(&ft); |
881 |
+ |
li.LowPart = ft.dwLowDateTime; |
882 |
+ |
li.HighPart = ft.dwHighDateTime; |
883 |
+ |
t = li.QuadPart; |
884 |
+ |
t -= t2; // From 1970 |
885 |
+ |
t /= 10; // In microseconds |
886 |
+ |
tp->tv_sec = (long)(t / 1000000); |
887 |
+ |
tp->tv_usec = (long)(t % 1000000); |
888 |
+ |
return 0; |
889 |
+ |
} |
890 |
+ |
|
891 |
+ |
#endif |
892 |
|
|
893 |
|
extern double |
894 |
|
getTime(void) /* get current time (CPU or real) */ |