| 120 |
|
r->rweight = minweight; |
| 121 |
|
return(0); |
| 122 |
|
} |
| 123 |
< |
return(r->rlvl <= abs(maxdepth) && r->rweight >= minweight ? 0 : -1); |
| 123 |
> |
return(r->rweight >= minweight && r->rlvl <= abs(maxdepth) ? 0 : -1); |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
|
| 127 |
|
extern void |
| 128 |
|
rayclear( /* clear a ray for (re)evaluation */ |
| 129 |
< |
register RAY *r |
| 129 |
> |
RAY *r |
| 130 |
|
) |
| 131 |
|
{ |
| 132 |
|
r->rno = raynum++; |
| 165 |
|
|
| 166 |
|
extern void |
| 167 |
|
raycont( /* check for clipped object and continue */ |
| 168 |
< |
register RAY *r |
| 168 |
> |
RAY *r |
| 169 |
|
) |
| 170 |
|
{ |
| 171 |
|
if ((r->clipset != NULL && inset(r->clipset, r->ro->omod)) || |
| 176 |
|
|
| 177 |
|
extern void |
| 178 |
|
raytrans( /* transmit ray as is */ |
| 179 |
< |
register RAY *r |
| 179 |
> |
RAY *r |
| 180 |
|
) |
| 181 |
|
{ |
| 182 |
|
RAY tr; |
| 192 |
|
|
| 193 |
|
extern int |
| 194 |
|
rayshade( /* shade ray r with material mod */ |
| 195 |
< |
register RAY *r, |
| 195 |
> |
RAY *r, |
| 196 |
|
int mod |
| 197 |
|
) |
| 198 |
|
{ |
| 199 |
< |
register OBJREC *m; |
| 199 |
> |
OBJREC *m; |
| 200 |
|
|
| 201 |
|
r->rt = r->rot; /* set effective ray length */ |
| 202 |
|
for ( ; mod != OVOID; mod = m->omod) { |
| 227 |
|
|
| 228 |
|
extern void |
| 229 |
|
rayparticipate( /* compute ray medium participation */ |
| 230 |
< |
register RAY *r |
| 230 |
> |
RAY *r |
| 231 |
|
) |
| 232 |
|
{ |
| 233 |
|
COLOR ce, ca; |
| 264 |
|
OBJECT mod |
| 265 |
|
) |
| 266 |
|
{ |
| 267 |
< |
register OBJREC *m; |
| 267 |
> |
OBJREC *m; |
| 268 |
|
/* execute textures and patterns */ |
| 269 |
|
for ( ; mod != OVOID; mod = m->omod) { |
| 270 |
|
m = objptr(mod); |
| 285 |
|
|
| 286 |
|
extern int |
| 287 |
|
raymixture( /* mix modifiers */ |
| 288 |
< |
register RAY *r, |
| 288 |
> |
RAY *r, |
| 289 |
|
OBJECT fore, |
| 290 |
|
OBJECT back, |
| 291 |
|
double coef |
| 293 |
|
{ |
| 294 |
|
RAY fr, br; |
| 295 |
|
int foremat, backmat; |
| 296 |
< |
register int i; |
| 296 |
> |
int i; |
| 297 |
|
/* bound coefficient */ |
| 298 |
|
if (coef > 1.0) |
| 299 |
|
coef = 1.0; |
| 345 |
|
|
| 346 |
|
extern double |
| 347 |
|
raydist( /* compute (cumulative) ray distance */ |
| 348 |
< |
register const RAY *r, |
| 349 |
< |
register int flags |
| 348 |
> |
const RAY *r, |
| 349 |
> |
int flags |
| 350 |
|
) |
| 351 |
|
{ |
| 352 |
|
double sum = 0.0; |
| 388 |
|
extern double |
| 389 |
|
raynormal( /* compute perturbed normal for ray */ |
| 390 |
|
FVECT norm, |
| 391 |
< |
register RAY *r |
| 391 |
> |
RAY *r |
| 392 |
|
) |
| 393 |
|
{ |
| 394 |
|
double newdot; |
| 395 |
< |
register int i; |
| 395 |
> |
int i; |
| 396 |
|
|
| 397 |
|
/* The perturbation is added to the surface normal to obtain |
| 398 |
|
* the new normal. If the new normal would affect the surface |
| 430 |
|
struct xfn *next; |
| 431 |
|
FULLXF xf; |
| 432 |
|
} xfseed = { &xfseed }, *xflast = &xfseed; |
| 433 |
< |
register struct xfn *xp; |
| 434 |
< |
register const RAY *rp; |
| 433 |
> |
struct xfn *xp; |
| 434 |
> |
const RAY *rp; |
| 435 |
|
|
| 436 |
|
/* |
| 437 |
|
* Search for transform in circular list that |
| 442 |
|
if (rp->rox == &xp->xf) { /* xp in use */ |
| 443 |
|
xp = xp->next; /* move to next */ |
| 444 |
|
if (xp == xflast) { /* need new one */ |
| 445 |
< |
xp = (struct xfn *)malloc(sizeof(struct xfn)); |
| 445 |
> |
xp = (struct xfn *)bmalloc(sizeof(struct xfn)); |
| 446 |
|
if (xp == NULL) |
| 447 |
|
error(SYSTEM, |
| 448 |
|
"out of memory in newrayxf"); |
| 461 |
|
|
| 462 |
|
extern void |
| 463 |
|
flipsurface( /* reverse surface orientation */ |
| 464 |
< |
register RAY *r |
| 464 |
> |
RAY *r |
| 465 |
|
) |
| 466 |
|
{ |
| 467 |
|
r->rod = -r->rod; |
| 493 |
|
|
| 494 |
|
extern int |
| 495 |
|
localhit( /* check for hit in the octree */ |
| 496 |
< |
register RAY *r, |
| 497 |
< |
register CUBE *scene |
| 496 |
> |
RAY *r, |
| 497 |
> |
CUBE *scene |
| 498 |
|
) |
| 499 |
|
{ |
| 500 |
|
OBJECT cxset[MAXCSET+1]; /* set of checked objects */ |
| 501 |
|
FVECT curpos; /* current cube position */ |
| 502 |
|
int sflags; /* sign flags */ |
| 503 |
|
double t, dt; |
| 504 |
< |
register int i; |
| 504 |
> |
int i; |
| 505 |
|
|
| 506 |
|
nrays++; /* increment trace counter */ |
| 507 |
|
sflags = 0; |
| 559 |
|
FVECT pos, /* current position, modified herein */ |
| 560 |
|
OBJECT *cxs, /* checked objects, modified by checkhit */ |
| 561 |
|
int dirf, /* direction indicators to speed tests */ |
| 562 |
< |
register RAY *r, |
| 563 |
< |
register CUBE *cu |
| 562 |
> |
RAY *r, |
| 563 |
> |
CUBE *cu |
| 564 |
|
) |
| 565 |
|
{ |
| 566 |
|
int ax; |
| 568 |
|
|
| 569 |
|
if (istree(cu->cutree)) { /* recurse on subcubes */ |
| 570 |
|
CUBE cukid; |
| 571 |
< |
register int br, sgn; |
| 571 |
> |
int br, sgn; |
| 572 |
|
|
| 573 |
|
cukid.cusize = cu->cusize * 0.5; /* find subcube */ |
| 574 |
|
VCOPY(cukid.cuorg, cu->cuorg); |
| 641 |
|
|
| 642 |
|
static int |
| 643 |
|
checkhit( /* check for hit in full cube */ |
| 644 |
< |
register RAY *r, |
| 644 |
> |
RAY *r, |
| 645 |
|
CUBE *cu, |
| 646 |
|
OBJECT *cxs |
| 647 |
|
) |
| 662 |
|
|
| 663 |
|
static void |
| 664 |
|
checkset( /* modify checked set and set to check */ |
| 665 |
< |
register OBJECT *os, /* os' = os - cs */ |
| 666 |
< |
register OBJECT *cs /* cs' = cs + os */ |
| 665 |
> |
OBJECT *os, /* os' = os - cs */ |
| 666 |
> |
OBJECT *cs /* cs' = cs + os */ |
| 667 |
|
) |
| 668 |
|
{ |
| 669 |
|
OBJECT cset[MAXCSET+MAXSET+1]; |
| 670 |
< |
register int i, j; |
| 670 |
> |
int i, j; |
| 671 |
|
int k; |
| 672 |
|
/* copy os in place, cset <- cs */ |
| 673 |
|
cset[0] = 0; |