--- ray/src/rt/srcobstr.c 2007/07/25 04:12:36 2.13 +++ ray/src/rt/srcobstr.c 2013/08/07 05:10:09 2.17 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: srcobstr.c,v 2.13 2007/07/25 04:12:36 greg Exp $"; +static const char RCSid[] = "$Id: srcobstr.c,v 2.17 2013/08/07 05:10:09 greg Exp $"; #endif /* * Source occlusion caching routines @@ -11,6 +11,8 @@ static const char RCSid[] = "$Id: srcobstr.c,v 2.13 20 #include "otspecial.h" +#include "rtotypes.h" + #include "source.h" #define ABS(x) ((x)>0 ? (x) : -(x)) @@ -61,7 +63,7 @@ initobscache(int sn) FVECT rorg, rdir; RREAL d; int i, j, k; - int ax, ax1, ax2; + int ax=0, ax1=1, ax2=2; if (srcp->sflags & (SSKIP|SPROX|SSPOT|SVIRTUAL)) return; /* don't cache these */ @@ -178,7 +180,7 @@ initobscache(int sn) static OBJECT * /* return occluder cache entry */ srcobstructp(register RAY *r) { - static unsigned long lastrno = ~0; + static RNUMBER lastrno = ~0; static OBJECT noobs; static OBJECT *lastobjp; SRCREC *srcp; @@ -198,7 +200,7 @@ srcobstructp(register RAY *r) initobscache(r->rsrc); /* compute cache index */ if (srcp->sflags & SDISTANT) { - int ax, ax1, ax2; + int ax=0, ax1=1, ax2=2; double t; ax = srcp->obscache->p.d.ax; if ((ax1 = ax+1) >= 3) ax1 -= 3; @@ -333,6 +335,12 @@ markclip(OBJREC *m) { OBJECT *set2add, *oldset; + if (m == NULL) { /* starting over */ + if (antimodlist != NULL) + free((void *)antimodlist); + antimodlist = NULL; + return; + } m_clip(m, NULL); /* initialize modifier list */ if ((set2add = (OBJECT *)m->os) == NULL || !set2add[0]) return;