| 1 |
< |
/* Copyright (c) 1994 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1995 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 34 |
|
{0, 5, NULL, Lambfa}, NULL, |
| 35 |
|
}; /* a Lambertian surface */ |
| 36 |
|
|
| 37 |
< |
static OBJREC Aftplane; /* aft clipping plane object */ |
| 37 |
> |
OBJREC Aftplane; /* aft clipping plane object */ |
| 38 |
|
|
| 39 |
|
static int raymove(), checkset(), checkhit(); |
| 40 |
|
|
| 81 |
|
{ |
| 82 |
|
r->rno = raynum++; |
| 83 |
|
r->newcset = r->clipset; |
| 84 |
< |
if (r->rmax > FTINY) { |
| 85 |
< |
r->ro = &Aftplane; |
| 86 |
< |
r->rot = r->rmax; |
| 87 |
< |
r->rop[0] = r->rorg[0] + r->rot*r->rdir[0]; |
| 88 |
< |
r->rop[1] = r->rorg[1] + r->rot*r->rdir[1]; |
| 89 |
< |
r->rop[2] = r->rorg[2] + r->rot*r->rdir[2]; |
| 90 |
< |
} else { |
| 91 |
< |
r->ro = NULL; |
| 92 |
< |
r->rot = FHUGE; |
| 93 |
< |
} |
| 84 |
> |
r->ro = NULL; |
| 85 |
> |
r->rot = FHUGE; |
| 86 |
|
r->pert[0] = r->pert[1] = r->pert[2] = 0.0; |
| 87 |
|
setcolor(r->pcol, 1.0, 1.0, 1.0); |
| 88 |
|
setcolor(r->rcol, 0.0, 0.0, 0.0); |
| 131 |
|
|
| 132 |
|
if (rayorigin(&tr, r, TRANS, 1.0) == 0) { |
| 133 |
|
VCOPY(tr.rdir, r->rdir); |
| 134 |
+ |
if (r->rmax > FTINY) |
| 135 |
+ |
tr.rmax = r->rmax - r->rot; |
| 136 |
|
rayvalue(&tr); |
| 137 |
|
copycolor(r->rcol, tr.rcol); |
| 138 |
|
r->rt = r->rot + tr.rt; |
| 195 |
|
error(USER, errmsg); |
| 196 |
|
} |
| 197 |
|
******/ |
| 198 |
< |
if ((*ofun[m->otype].funp)(m, r)) |
| 199 |
< |
objerror(r->ro, USER, "conflicting materials"); |
| 198 |
> |
if ((*ofun[m->otype].funp)(m, r)) { |
| 199 |
> |
sprintf(errmsg, "conflicting material \"%s\"", |
| 200 |
> |
m->oname); |
| 201 |
> |
objerror(r->ro, USER, errmsg); |
| 202 |
> |
} |
| 203 |
|
} |
| 204 |
|
depth--; /* end here */ |
| 205 |
|
} |
| 364 |
|
} |
| 365 |
|
if (sflags == 0) |
| 366 |
|
error(CONSISTENCY, "zero ray direction in localhit"); |
| 367 |
+ |
/* start off assuming nothing hit */ |
| 368 |
+ |
if (r->rmax > FTINY) { /* except aft plane if one */ |
| 369 |
+ |
r->ro = &Aftplane; |
| 370 |
+ |
r->rot = r->rmax; |
| 371 |
+ |
for (i = 0; i < 3; i++) |
| 372 |
+ |
r->rop[i] = r->rorg[i] + r->rot*r->rdir[i]; |
| 373 |
+ |
} |
| 374 |
+ |
/* find global cube entrance point */ |
| 375 |
|
t = 0.0; |
| 376 |
|
if (!incube(scene, curpos)) { |
| 377 |
|
/* find distance to entry */ |
| 389 |
|
t = dt; /* farthest face is the one */ |
| 390 |
|
} |
| 391 |
|
t += FTINY; /* fudge to get inside cube */ |
| 392 |
+ |
if (t >= r->rot) /* clipped already */ |
| 393 |
+ |
return(0); |
| 394 |
|
/* advance position */ |
| 395 |
|
for (i = 0; i < 3; i++) |
| 396 |
|
curpos[i] += r->rdir[i]*t; |
| 399 |
|
return(0); |
| 400 |
|
} |
| 401 |
|
cxset[0] = 0; |
| 402 |
< |
return(raymove(curpos, cxset, sflags, r, scene) == RAYHIT && |
| 403 |
< |
r->ro != &Aftplane); |
| 402 |
> |
raymove(curpos, cxset, sflags, r, scene); |
| 403 |
> |
return(r->ro != NULL & r->ro != &Aftplane); |
| 404 |
|
} |
| 405 |
|
|
| 406 |
|
|
| 455 |
|
} |
| 456 |
|
/*NOTREACHED*/ |
| 457 |
|
} |
| 458 |
< |
if (isfull(cu->cutree) && checkhit(r, cu, cxs)) |
| 458 |
> |
if (isfull(cu->cutree)) { |
| 459 |
> |
if (checkhit(r, cu, cxs)) |
| 460 |
> |
return(RAYHIT); |
| 461 |
> |
} else if (r->ro == &Aftplane && incube(cu, r->rop)) |
| 462 |
|
return(RAYHIT); |
| 463 |
|
/* advance to next cube */ |
| 464 |
|
if (dirf&0x11) { |