home *** CD-ROM | disk | FTP | other *** search
- #include "ray.h"
-
- struct intersect intersect(r)
- struct ray r;
- {struct intersect i,imin;
- register struct objlist *ol;
- register int o;
- imin.obj=0;
- if(fflag)
- { if(objects[r.obj].flags&SELF)
- { i=(*objects[r.obj].shape)(r,r.obj);
- if(i.obj)
- imin=i;
- }
- for(ol=candidates[r.obj][dindex(r.l)];ol;ol=ol->next)
- { if(oflag&&imin.obj&&imin.t<ol->t)
- break;
- i=(*objects[ol->obj].shape)(r,ol->obj);
- if(i.obj&&(!imin.obj||i.t<imin.t))
- imin=i;
- }
- }
- else
- for(o=lights+1;o<maxobj;o++)
- { i=(*objects[o].shape)(r,o);
- if(i.obj&&(!imin.obj||i.t<imin.t))
- imin=i;
- }
- return imin;
- }
-