--- ray/src/hd/viewbeams.c 2003/02/22 02:07:25 3.2 +++ ray/src/hd/viewbeams.c 2004/01/01 11:21:55 3.7 @@ -1,10 +1,12 @@ #ifndef lint -static const char RCSid[] = "$Id: viewbeams.c,v 3.2 2003/02/22 02:07:25 greg Exp $"; +static const char RCSid[] = "$Id: viewbeams.c,v 3.7 2004/01/01 11:21:55 schorsch Exp $"; #endif /* * Convert view to beam list. */ +#include + #include "rholo.h" #include "view.h" #include "random.h" @@ -24,9 +26,12 @@ static const char RCSid[] = "$Id: viewbeams.c,v 3.2 20 static BEAMLIST blist; -static -add2blist(hd, bi, nr) /* add to beam sample list */ -int hd, bi, nr; +static void +add2blist( /* add to beam sample list */ + int hd, + int bi, + int nr +) { register int i; @@ -37,7 +42,7 @@ int hd, bi, nr; } i = blist.nb++; /* else add beam to list */ if (i % BALLOCBLK == 0) { - blist.bl = (PACKHEAD *)realloc((char *)blist.bl, + blist.bl = (PACKHEAD *)realloc((void *)blist.bl, (i+BALLOCBLK)*sizeof(PACKHEAD)); CHECK(blist.bl==NULL, SYSTEM, "out of memory in add2blist"); } @@ -46,14 +51,16 @@ int hd, bi, nr; } -int2 * -viewbeams(vp, hr, vr, blp) /* convert view into sections/beams */ -VIEW *vp; -int hr, vr; -BEAMLIST *blp; +extern int16 * +viewbeams( /* convert view into sections/beams */ + VIEW *vp, + int hr, + int vr, + BEAMLIST *blp +) { - static int2 sectlist[HDMAX+1]; - int2 sectarr[MINRES+1][MINRES+1]; + static int16 sectlist[HDMAX+1]; + int16 sectarr[MINRES+1][MINRES+1]; double d0, d1, mindist; GCOORD gc[2]; FVECT rorg, rdir; @@ -61,7 +68,7 @@ BEAMLIST *blp; int v; register int h, hd; /* clear section flags */ - bzero((char *)sectlist, sizeof(sectlist)); + memset((char *)sectlist, '\0', sizeof(sectlist)); /* identify view sections */ for (v = 0; v <= MINRES; v++) for (h = 0; h <= MINRES; h++) { @@ -138,15 +145,16 @@ loopexit: /* add samples */ add2blist(hd, hdbindex(hdlist[hd],gc), sampquant); } - copystruct(blp, &blist); /* transfer beam list */ + *blp = blist; /* transfer beam list */ return(sectlist); /* all done! */ } -int -nextview(vp, fp) /* get next view from fp */ -VIEW *vp; -FILE *fp; +extern int +nextview( /* get next view from fp */ + VIEW *vp, + FILE *fp +) { char linebuf[256];