--- ray/src/rt/srcsupp.c 1991/08/14 08:19:20 1.11 +++ ray/src/rt/srcsupp.c 1991/09/13 13:44:10 1.13 @@ -49,17 +49,19 @@ initstypes() /* initialize source dispatch table */ int newsource() /* allocate new source in our array */ { +#define SRCINC 4 if (nsources == 0) - source = (SRCREC *)malloc(sizeof(SRCREC)); - else + source = (SRCREC *)malloc(SRCINC*sizeof(SRCREC)); + else if (nsources%SRCINC == 0) source = (SRCREC *)realloc((char *)source, - (unsigned)(nsources+1)*sizeof(SRCREC)); + (unsigned)(nsources+SRCINC)*sizeof(SRCREC)); if (source == NULL) return(-1); source[nsources].sflags = 0; source[nsources].nhits = 1; source[nsources].ntests = 2; /* initial hit probability = 1/2 */ return(nsources++); +#undef SRCINC } @@ -392,7 +394,7 @@ register RAY *r; first = 0; last = nsources-1; } for (i = first; i <= last; i++) - if (source[i].sflags & SDISTANT) + if ((source[i].sflags & (SDISTANT|SVIRTUAL)) == SDISTANT) /* * Check to see if ray is within * solid angle of source.