--- ray/src/rt/source.c 2011/08/02 22:47:30 2.61 +++ ray/src/rt/source.c 2014/05/07 02:08:12 2.62 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: source.c,v 2.61 2011/08/02 22:47:30 greg Exp $"; +static const char RCSid[] = "$Id: source.c,v 2.62 2014/05/07 02:08:12 greg Exp $"; #endif /* * source.c - routines dealing with illumination sources. @@ -13,8 +13,6 @@ static const char RCSid[] = "$Id: source.c,v 2.61 2011 #include "source.h" #include "random.h" -extern double ssampdist; /* scatter sampling distance */ - #ifndef MAXSSAMP #define MAXSSAMP 16 /* maximum samples per ray */ #endif @@ -42,8 +40,8 @@ static int maxcntr = 0; /* size of contribution arra static int cntcmp(const void *p1, const void *p2); -extern OBJREC * /* find an object's actual material */ -findmaterial(register OBJREC *o) +OBJREC * /* find an object's actual material */ +findmaterial(OBJREC *o) { while (!ismaterial(o->otype)) { if (o->otype == MOD_ALIAS && o->oargs.nsargs) { @@ -68,13 +66,13 @@ findmaterial(register OBJREC *o) } -extern void +void marksources(void) /* find and mark source objects */ { int foundsource = 0; int i; - register OBJREC *o, *m; - register int ns; + OBJREC *o, *m; + int ns; /* initialize dispatch table */ initstypes(); /* find direct sources */ @@ -157,7 +155,7 @@ memerr: } -extern void +void freesources(void) /* free all source structures */ { if (nsources > 0) { @@ -180,15 +178,15 @@ freesources(void) /* free all source structures */ } -extern int +int srcray( /* send a ray to a source, return domega */ - register RAY *sr, /* returned source ray */ + RAY *sr, /* returned source ray */ RAY *r, /* ray which hit object */ SRCINDEX *si /* source sample index */ ) { double d; /* distance to source */ - register SRCREC *srcp; + SRCREC *srcp; rayorigin(sr, SHADOW, r, NULL); /* ignore limits */ @@ -222,12 +220,12 @@ srcray( /* send a ray to a source, return domega */ } -extern void +void srcvalue( /* punch ray to source and compute value */ - register RAY *r + RAY *r ) { - register SRCREC *sp; + SRCREC *sp; sp = &source[r->rsrc]; if (sp->sflags & SVIRTUAL) { /* virtual source */ @@ -279,15 +277,15 @@ transillum( /* check if material is transparent illu } -extern int +int sourcehit( /* check to see if ray hit distant source */ - register RAY *r + RAY *r ) { int glowsrc = -1; int transrc = -1; int first, last; - register int i; + int i; if (r->rsrc >= 0) { /* check only one if aimed */ first = last = r->rsrc; @@ -355,8 +353,8 @@ cntcmp( /* contribution compare (descending) */ const void *p2 ) { - register const CNTPTR *sc1 = (const CNTPTR *)p1; - register const CNTPTR *sc2 = (const CNTPTR *)p2; + const CNTPTR *sc1 = (const CNTPTR *)p1; + const CNTPTR *sc2 = (const CNTPTR *)p2; if (sc1->brt > sc2->brt) return(-1); @@ -366,15 +364,15 @@ cntcmp( /* contribution compare (descending) */ } -extern void +void direct( /* add direct component */ RAY *r, /* ray that hit surface */ srcdirf_t *f, /* direct component coefficient function */ void *p /* data for f */ ) { - register int sn; - register CONTRIB *scp; + int sn; + CONTRIB *scp; SRCINDEX si; int nshadcheck, ncnts; int nhits; @@ -422,7 +420,7 @@ direct( /* add direct component */ /* sort contributions */ qsort(cntord, sn, sizeof(CNTPTR), cntcmp); { /* find last */ - register int l, m; + int l, m; ncnts = l = sn; sn = 0; @@ -517,9 +515,9 @@ direct( /* add direct component */ } -extern void +void srcscatter( /* compute source scattering into ray */ - register RAY *r + RAY *r ) { int oldsampndx; @@ -682,10 +680,10 @@ weaksrcmat(OBJECT obj) /* identify material */ distglow(m, r, raydist(r,PRIMARY))) -extern int +int m_light( /* ray hit a light source */ - register OBJREC *m, - register RAY *r + OBJREC *m, + RAY *r ) { /* check for over-counting */