118 |
|
unsigned long vcount = (hresolu > 1) ? (unsigned long)hresolu*vresolu |
119 |
|
: (unsigned long)vresolu; |
120 |
|
long nextflush = (vresolu > 0) & (hresolu > 1) ? 0 : hresolu; |
121 |
+ |
int bogusflushed = 0; |
122 |
|
FILE *fp; |
123 |
|
double d; |
124 |
|
FVECT orig, direc; |
155 |
|
if (hresolu > 0) { |
156 |
|
if (vresolu > 0) |
157 |
|
fprtresolu(hresolu, vresolu, stdout); |
158 |
< |
fflush(stdout); |
158 |
> |
else |
159 |
> |
fflush(stdout); |
160 |
|
} |
161 |
|
/* process file */ |
162 |
|
while (getvec(orig, inform, fp) == 0 && |
164 |
|
|
165 |
|
d = normalize(direc); |
166 |
|
if (d == 0.0) { /* zero ==> flush */ |
167 |
< |
if (--nextflush <= 0 || !vcount) { |
167 |
> |
if ((--nextflush <= 0) | !vcount && !bogusflushed) { |
168 |
|
if (ray_pnprocs > 1 && ray_fifo_flush() < 0) |
169 |
|
error(USER, "child(ren) died"); |
170 |
|
bogusray(); |
171 |
|
fflush(stdout); |
172 |
+ |
bogusflushed = 1; |
173 |
|
nextflush = (vresolu > 0) & (hresolu > 1) ? 0 : |
174 |
|
hresolu; |
175 |
|
} else |
182 |
|
error(USER, "child(ren) died"); |
183 |
|
fflush(stdout); |
184 |
|
nextflush = hresolu; |
185 |
< |
} |
185 |
> |
} else |
186 |
> |
bogusflushed = 0; |
187 |
|
} |
188 |
|
if (ferror(stdout)) |
189 |
|
error(SYSTEM, "write error"); |
318 |
|
static void |
319 |
|
bogusray(void) /* print out empty record */ |
320 |
|
{ |
317 |
– |
thisray.rorg[0] = thisray.rorg[1] = thisray.rorg[2] = |
318 |
– |
thisray.rdir[0] = thisray.rdir[1] = thisray.rdir[2] = 0.0; |
319 |
– |
thisray.rmax = 0.0; |
321 |
|
rayorigin(&thisray, PRIMARY, NULL, NULL); |
322 |
|
printvals(&thisray); |
323 |
|
} |