| 20 |
|
#include "ray.h" |
| 21 |
|
#include "ambient.h" |
| 22 |
|
#include "random.h" |
| 23 |
– |
#include "source.h" |
| 24 |
– |
#include "otypes.h" |
| 25 |
– |
#include "otspecial.h" |
| 23 |
|
|
| 24 |
|
#ifndef OLDAMB |
| 25 |
|
|
| 646 |
|
FVECT vec; |
| 647 |
|
double u, v; |
| 648 |
|
double ang, a1; |
| 652 |
– |
OBJREC *m; |
| 649 |
|
int i, j; |
| 650 |
|
/* don't bother for a few samples */ |
| 651 |
|
if (hp->ns < 8) |
| 674 |
|
for (a1 = ang-ang_res; a1 <= ang+ang_res; a1 += ang_step) |
| 675 |
|
flgs |= 1L<<(int)(16/PI*(a1 + 2.*PI*(a1 < 0))); |
| 676 |
|
} |
| 681 |
– |
/* add low-angle incident (< 20deg) */ |
| 682 |
– |
if (fabs(hp->rp->rod) <= 0.342 && hp->rp->parent != NULL && |
| 683 |
– |
(m = findmaterial(hp->rp->parent->ro)) != NULL && |
| 684 |
– |
isopaque(m->otype)) { |
| 685 |
– |
u = -DOT(hp->rp->rdir, uv[0]); |
| 686 |
– |
v = -DOT(hp->rp->rdir, uv[1]); |
| 687 |
– |
if ((r0*r0*u*u + r1*r1*v*v) > hp->rp->rot*hp->rp->rot) { |
| 688 |
– |
ang = atan2a(v, u); |
| 689 |
– |
ang += 2.*PI*(ang < 0); |
| 690 |
– |
ang *= 16/PI; |
| 691 |
– |
if ((ang < .5) | (ang >= 31.5)) |
| 692 |
– |
flgs |= 0x80000001; |
| 693 |
– |
else |
| 694 |
– |
flgs |= 3L<<(int)(ang-.5); |
| 695 |
– |
} |
| 696 |
– |
} |
| 677 |
|
return(flgs); |
| 678 |
|
} |
| 679 |
|
|