1 |
< |
/* Copyright (c) 1992 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"; |
119 |
|
} |
120 |
|
src->srad = sqrt(src->srad); |
121 |
|
/* compute size vectors */ |
122 |
< |
if (f->nv == 4 || (f->nv == 5 && /* parallelogram case */ |
123 |
< |
dist2(VERTEX(f,0),VERTEX(f,4)) <= FTINY*FTINY)) |
122 |
> |
if (f->nv == 4) /* parallelogram case */ |
123 |
|
for (j = 0; j < 3; j++) { |
124 |
|
src->ss[SU][j] = .5*(VERTEX(f,1)[j]-VERTEX(f,0)[j]); |
125 |
|
src->ss[SV][j] = .5*(VERTEX(f,3)[j]-VERTEX(f,0)[j]); |
251 |
|
} |
252 |
|
|
253 |
|
|
254 |
< |
spotout(r, s, dist) /* check if we're outside spot region */ |
254 |
> |
spotout(r, s) /* check if we're outside spot region */ |
255 |
|
register RAY *r; |
256 |
|
register SPOT *s; |
258 |
– |
int dist; |
257 |
|
{ |
258 |
|
double d; |
259 |
|
FVECT vd; |
260 |
|
|
261 |
|
if (s == NULL) |
262 |
|
return(0); |
263 |
< |
if (dist) { /* distant source */ |
263 |
> |
if (s->flen < -FTINY) { /* distant source */ |
264 |
|
vd[0] = s->aim[0] - r->rorg[0]; |
265 |
|
vd[1] = s->aim[1] - r->rorg[1]; |
266 |
|
vd[2] = s->aim[2] - r->rorg[2]; |
493 |
|
for (i = 0; i < 3; i++) |
494 |
|
cc[i] = c1[i] + l*disp[i]; |
495 |
|
return(a2); |
498 |
– |
} |
499 |
– |
|
500 |
– |
|
501 |
– |
sourcehit(r) /* check to see if ray hit distant source */ |
502 |
– |
register RAY *r; |
503 |
– |
{ |
504 |
– |
int first, last; |
505 |
– |
register int i; |
506 |
– |
|
507 |
– |
if (r->rsrc >= 0) { /* check only one if aimed */ |
508 |
– |
first = last = r->rsrc; |
509 |
– |
} else { /* otherwise check all */ |
510 |
– |
first = 0; last = nsources-1; |
511 |
– |
} |
512 |
– |
for (i = first; i <= last; i++) |
513 |
– |
if ((source[i].sflags & (SDISTANT|SVIRTUAL)) == SDISTANT) |
514 |
– |
/* |
515 |
– |
* Check to see if ray is within |
516 |
– |
* solid angle of source. |
517 |
– |
*/ |
518 |
– |
if (2.0*PI * (1.0 - DOT(source[i].sloc,r->rdir)) |
519 |
– |
<= source[i].ss2) { |
520 |
– |
r->ro = source[i].so; |
521 |
– |
if (!(source[i].sflags & SSKIP)) |
522 |
– |
break; |
523 |
– |
} |
524 |
– |
|
525 |
– |
if (r->ro != NULL) { |
526 |
– |
for (i = 0; i < 3; i++) |
527 |
– |
r->ron[i] = -r->rdir[i]; |
528 |
– |
r->rod = 1.0; |
529 |
– |
r->rox = NULL; |
530 |
– |
return(1); |
531 |
– |
} |
532 |
– |
return(0); |
496 |
|
} |