17 |
|
|
18 |
|
#define MAXCSET ((MAXSET+1)*2-1) /* maximum check set size */ |
19 |
|
|
20 |
< |
unsigned long raynum = 0; /* next unique ray number */ |
21 |
< |
unsigned long nrays = 0; /* number of calls to localhit */ |
20 |
> |
RNUMBER raynum = 0; /* next unique ray number */ |
21 |
> |
RNUMBER nrays = 0; /* number of calls to localhit */ |
22 |
|
|
23 |
|
static RREAL Lambfa[5] = {PI, PI, PI, 0.0, 0.0}; |
24 |
|
OBJREC Lamb = { |
361 |
|
|
362 |
|
extern void |
363 |
|
raycontrib( /* compute (cumulative) ray contribution */ |
364 |
< |
double rc[3], |
364 |
> |
RREAL rc[3], |
365 |
|
const RAY *r, |
366 |
|
int flags |
367 |
|
) |
512 |
|
else if (r->rdir[i] < -1e-7) |
513 |
|
sflags |= 0x10 << i; |
514 |
|
} |
515 |
< |
if (sflags == 0) |
516 |
< |
error(CONSISTENCY, "zero ray direction in localhit"); |
515 |
> |
if (!sflags) { |
516 |
> |
error(WARNING, "zero ray direction in localhit"); |
517 |
> |
return(0); |
518 |
> |
} |
519 |
|
/* start off assuming nothing hit */ |
520 |
|
if (r->rmax > FTINY) { /* except aft plane if one */ |
521 |
|
r->ro = &Aftplane; |
522 |
|
r->rot = r->rmax; |
523 |
< |
for (i = 0; i < 3; i++) |
522 |
< |
r->rop[i] = r->rorg[i] + r->rot*r->rdir[i]; |
523 |
> |
VSUM(r->rop, r->rorg, r->rdir, r->rot); |
524 |
|
} |
525 |
|
/* find global cube entrance point */ |
526 |
|
t = 0.0; |
543 |
|
if (t >= r->rot) /* clipped already */ |
544 |
|
return(0); |
545 |
|
/* advance position */ |
546 |
< |
for (i = 0; i < 3; i++) |
546 |
< |
curpos[i] += r->rdir[i]*t; |
546 |
> |
VSUM(curpos, curpos, r->rdir, t); |
547 |
|
|
548 |
|
if (!incube(scene, curpos)) /* non-intersecting ray */ |
549 |
|
return(0); |
634 |
|
ax = 2; |
635 |
|
} |
636 |
|
} |
637 |
< |
pos[0] += r->rdir[0]*t; |
638 |
< |
pos[1] += r->rdir[1]*t; |
639 |
< |
pos[2] += r->rdir[2]*t; |
637 |
> |
VSUM(pos, pos, r->rdir, t); |
638 |
|
return(ax); |
639 |
|
} |
640 |
|
|