16 |
|
* xorg yorg zorg xdir ydir zdir |
17 |
|
* |
18 |
|
* The direction need not be normalized. Output is flexible. |
19 |
+ |
* If the direction vector is (0,0,0), then the output is flushed. |
20 |
|
* All values default to ascii representation of real |
21 |
|
* numbers. Binary representations can be selected |
22 |
|
* with '-ff' for float or '-fd' for double. By default, |
36 |
|
int vresolu = 0; /* vertical resolution */ |
37 |
|
|
38 |
|
double dstrsrc = 0.0; /* square source distribution */ |
39 |
+ |
double shadthresh = .05; /* shadow threshold */ |
40 |
+ |
double shadcert = .5; /* shadow certainty */ |
41 |
|
|
42 |
|
int maxdepth = 6; /* maximum recursion depth */ |
43 |
|
double minweight = 4e-3; /* minimum ray weight */ |
44 |
|
|
45 |
|
COLOR ambval = BLKCOLOR; /* ambient value */ |
46 |
|
double ambacc = 0.2; /* ambient accuracy */ |
47 |
< |
int ambres = 128; /* ambient resolution */ |
47 |
> |
int ambres = 32; /* ambient resolution */ |
48 |
|
int ambdiv = 128; /* ambient divisions */ |
49 |
|
int ambssamp = 0; /* ambient super-samples */ |
50 |
|
int ambounce = 0; /* ambient bounces */ |
76 |
|
long vcount = hresolu>1 ? hresolu*vresolu : vresolu; |
77 |
|
long nextflush = hresolu; |
78 |
|
FILE *fp; |
79 |
< |
FVECT orig, direc, vcol; |
79 |
> |
FVECT orig, direc; |
80 |
|
/* set up input */ |
81 |
|
if (fname == NULL) |
82 |
|
fp = stdin; |
95 |
|
while (getvec(orig, inform, fp) == 0 && |
96 |
|
getvec(direc, inform, fp) == 0) { |
97 |
|
|
98 |
< |
if (normalize(direc) == 0.0) |
99 |
< |
error(USER, "zero direction vector"); |
98 |
> |
if (normalize(direc) == 0.0) { /* zero ==> flush */ |
99 |
> |
fflush(stdout); |
100 |
> |
continue; |
101 |
> |
} |
102 |
|
/* compute and print */ |
103 |
|
if (outvals[0] == 'i') |
104 |
|
irrad(orig, direc); |
105 |
|
else |
106 |
|
radiance(orig, direc); |
107 |
< |
/* flush if requested */ |
107 |
> |
/* flush if time */ |
108 |
|
if (--nextflush == 0) { |
109 |
|
fflush(stdout); |
110 |
|
nextflush = hresolu; |
226 |
|
return(-1); |
227 |
|
break; |
228 |
|
case 'f': /* binary float */ |
229 |
< |
if (fread(vf, sizeof(float), 3, fp) != 3) |
229 |
> |
if (fread((char *)vf, sizeof(float), 3, fp) != 3) |
230 |
|
return(-1); |
231 |
|
vec[0] = vf[0]; vec[1] = vf[1]; vec[2] = vf[2]; |
232 |
|
break; |
233 |
|
case 'd': /* binary double */ |
234 |
< |
if (fread(vec, sizeof(double), 3, fp) != 3) |
234 |
> |
if (fread((char *)vec, sizeof(double), 3, fp) != 3) |
235 |
|
return(-1); |
236 |
|
break; |
237 |
|
} |
382 |
|
putd(v) /* print binary double */ |
383 |
|
double v; |
384 |
|
{ |
385 |
< |
fwrite(&v, sizeof(v), 1, stdout); |
385 |
> |
fwrite((char *)&v, sizeof(v), 1, stdout); |
386 |
|
} |
387 |
|
|
388 |
|
|
392 |
|
{ |
393 |
|
float f = v; |
394 |
|
|
395 |
< |
fwrite(&f, sizeof(f), 1, stdout); |
395 |
> |
fwrite((char *)&f, sizeof(f), 1, stdout); |
396 |
|
} |