254 |
|
double or, d; |
255 |
|
int infront; |
256 |
|
int ssn; |
257 |
< |
int nhit; |
257 |
> |
int nhit, nok; |
258 |
|
register int i, n; |
259 |
|
/* return if pretesting disabled */ |
260 |
|
if (vspretest <= 0) |
280 |
|
/* sample */ |
281 |
|
or = sqrt(or2); |
282 |
|
ssn = 25*n; |
283 |
< |
nhit = 0; |
283 |
> |
nhit = nok = 0; |
284 |
|
while (n-- > 0) { |
285 |
|
/* get sample point */ |
286 |
|
do { |
316 |
|
rayvalue(&sr); |
317 |
|
if (bright(sr.rcol) <= FTINY) |
318 |
|
continue; |
319 |
+ |
nok++; |
320 |
|
/* check against obstructions */ |
321 |
|
srcray(&sr, NULL, sn); |
322 |
|
rayvalue(&sr); |
323 |
< |
if (bright(sr.rcol) <= FTINY) { |
324 |
< |
if (nhit > 0) { |
323 |
> |
if (bright(sr.rcol) > FTINY) |
324 |
> |
nhit++; |
325 |
> |
if (nhit > 0 && nhit < nok) { |
326 |
|
#ifdef DEBUG |
327 |
< |
fprintf(stderr, "\tpartially occluded\n"); |
327 |
> |
fprintf(stderr, "\tpartially occluded\n"); |
328 |
|
#endif |
329 |
< |
return(f); /* need to shadow test */ |
330 |
< |
} |
329 |
< |
} else |
330 |
< |
nhit++; |
329 |
> |
return(f); /* need to shadow test */ |
330 |
> |
} |
331 |
|
} |
332 |
|
if (nhit == 0) { |
333 |
|
#ifdef DEBUG |