--- ray/src/rt/virtuals.c 2003/02/25 02:47:23 2.8 +++ ray/src/rt/virtuals.c 2004/03/01 18:11:20 2.12 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: virtuals.c,v 2.8 2003/02/25 02:47:23 greg Exp $"; +static const char RCSid[] = "$Id: virtuals.c,v 2.12 2004/03/01 18:11:20 greg Exp $"; #endif /* * Routines for simulating virtual light sources @@ -35,7 +35,7 @@ markvirtuals() /* find and mark virtual sources */ if (directrelay <= 0) return; /* find virtual source objects */ - for (i = 0; i < nobjects; i++) { + for (i = 0; i < nsceneobjs; i++) { o = objptr(i); if (!issurface(o->otype) || o->omod == OVOID) continue; @@ -49,7 +49,7 @@ markvirtuals() /* find and mark virtual sources */ if (nvobjects == 0) vobject = (OBJECT *)malloc(sizeof(OBJECT)); else - vobject = (OBJECT *)realloc((char *)vobject, + vobject = (OBJECT *)realloc((void *)vobject, (unsigned)(nvobjects+1)*sizeof(OBJECT)); if (vobject == NULL) error(SYSTEM, "out of memory in addvirtuals"); @@ -123,7 +123,7 @@ OBJREC *o; register OBJREC *m; i = o->omod; - m = objptr(i); + m = findmaterial(objptr(i)); if (m->otype != MAT_ILLUM || m->oargs.nsargs < 1 || !strcmp(m->oargs.sarg[0], VOIDID) || (i = lastmod(objndx(m), m->oargs.sarg[0])) == OVOID) @@ -194,7 +194,7 @@ MAT4 pm; else nsflags &= ~SSPOT; if (source[sn].sflags & SSPOT) { - copystruct(&theirspot, source[sn].sl.s); + theirspot = *(source[sn].sl.s); multv3(theirspot.aim, source[sn].sl.s->aim, pm); normalize(theirspot.aim); if (nsflags & SSPOT) { @@ -204,7 +204,7 @@ MAT4 pm; return(-1); /* no overlap */ } else { nsflags |= SSPOT; - copystruct(&ourspot, &theirspot); + ourspot = theirspot; d = 2.*ourspot.siz; } if (ourspot.siz < d-FTINY) { /* it shrunk */ @@ -244,7 +244,7 @@ MAT4 pm; if (nsflags & SSPOT) { if ((source[i].sl.s = (SPOT *)malloc(sizeof(SPOT))) == NULL) goto memerr; - copystruct(source[i].sl.s, &ourspot); + *(source[i].sl.s) = ourspot; } if (nsflags & SPROX) source[i].sl.prox = source[sn].sl.prox;