45 |
|
extern int hresolu; /* horizontal resolution */ |
46 |
|
extern int vresolu; /* vertical resolution */ |
47 |
|
|
48 |
< |
static int castonly = 0; |
48 |
> |
extern int castonly; /* only doing ray-casting? */ |
49 |
|
|
50 |
|
#ifndef MAXTSET |
51 |
|
#define MAXTSET 8191 /* maximum number in trace set */ |
68 |
|
oputr, oputR, oputx, oputX, oputn, oputN, oputs, |
69 |
|
oputw, oputW, oputm, oputM, oputtilde; |
70 |
|
|
71 |
– |
static void setoutput(char *vs); |
71 |
|
extern void tranotify(OBJECT obj); |
72 |
+ |
static void setoutput(char *vs); |
73 |
+ |
static int is_fifo(FILE *fp); |
74 |
|
static void bogusray(void); |
75 |
|
static void raycast(RAY *r); |
76 |
|
static void rayirrad(RAY *r); |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
< |
extern void |
121 |
> |
void |
122 |
|
rtrace( /* trace rays from file */ |
123 |
|
char *fname, |
124 |
|
int nproc |
462 |
|
|
463 |
|
|
464 |
|
static int |
465 |
+ |
is_fifo( /* check if file pointer connected to pipe */ |
466 |
+ |
FILE *fp |
467 |
+ |
) |
468 |
+ |
{ |
469 |
+ |
#ifdef S_ISFIFO |
470 |
+ |
struct stat sbuf; |
471 |
+ |
|
472 |
+ |
if (fstat(fileno(fp), &sbuf) < 0) |
473 |
+ |
error(SYSTEM, "fstat() failed on input stream"); |
474 |
+ |
return(S_ISFIFO(sbuf.st_mode)); |
475 |
+ |
#else |
476 |
+ |
return (fp == stdin); /* just a guess, really */ |
477 |
+ |
#endif |
478 |
+ |
} |
479 |
+ |
|
480 |
+ |
|
481 |
+ |
static int |
482 |
|
getvec( /* get a vector from fp */ |
483 |
|
FVECT vec, |
484 |
|
int fmt, |
542 |
|
int rsiz = 6*20; /* conservative ascii ray size */ |
543 |
|
if (inform == 'f') rsiz = 6*sizeof(float); |
544 |
|
else if (inform == 'd') rsiz = 6*sizeof(double); |
545 |
< |
if ((inpfp == stdin) & (qlength*rsiz > 512)) /* pipe limit */ |
545 |
> |
/* check against pipe limit */ |
546 |
> |
if (qlength*rsiz > 512 && is_fifo(inpfp)) |
547 |
|
inp_queue = (FVECT *)malloc(sizeof(FVECT)*2*qlength); |
548 |
|
inp_qend = -(inp_queue == NULL); /* flag for no queue */ |
549 |
|
} |