--- ray/src/cv/ies2rad.c 1996/06/12 19:13:42 2.13 +++ ray/src/cv/ies2rad.c 1997/07/25 11:18:18 2.15 @@ -12,6 +12,7 @@ static char SCCSid[] = "$SunId$ LBL"; #include #include +#include #include #include "color.h" #include "paths.h" @@ -127,6 +128,7 @@ extern char *strcpy(), *strcat(), *stradd(), *tailtrun *filename(), *libname(), *fullname(), *malloc(), *getword(), *atos(); extern float *matchlamp(); +extern time_t fdate(); #define scnint(fp,ip) cvtint(ip,getword(fp)) #define scnflt(fp,rp) cvtflt(rp,getword(fp)) @@ -712,6 +714,7 @@ FILE *fp; char *mod, *name; int dolower, doupper; { + int dosides = 0; char buf[MAXWORD]; fprintf(fp, "\n%s %s %s_light\n", mod, @@ -722,15 +725,13 @@ int dolower, doupper; lampcolor[1]/shp->area, lampcolor[2]/shp->area); if (doupper && dolower && shp->type != SPHERE && shp->h > MINDIM) - if (shp->isillum) { - fprintf(fp, "\nvoid illum %s_glow\n", name); - fprintf(fp, "0\n0\n3 0 0 0\n"); - } else { + if (!shp->isillum) { fprintf(fp, "\n%s glow %s_glow\n", mod, name); fprintf(fp, "0\n0\n4 %g %g %g -1\n", lampcolor[0]/shp->area, lampcolor[1]/shp->area, lampcolor[2]/shp->area); + dosides++; } switch (shp->type) { case RECT: @@ -739,7 +740,7 @@ int dolower, doupper; putrectsrc(shp, fp, buf, name, 0); if (doupper) putrectsrc(shp, fp, buf, name, 1); - if (doupper && dolower && shp->h > MINDIM) { + if (dosides) { strcat(strcpy(buf, name), "_glow"); putsides(shp, fp, buf, name); } @@ -750,7 +751,7 @@ int dolower, doupper; putdisksrc(shp, fp, buf, name, 0); if (doupper) putdisksrc(shp, fp, buf, name, 1); - if (doupper && dolower && shp->h > MINDIM) { + if (dosides) { strcat(strcpy(buf, name), "_glow"); putcyl(shp, fp, buf, name); } @@ -1048,7 +1049,8 @@ FILE *outfp; /* close output file upon return */ strcpy(cp, "| oconv - > "); cp += 12; fullname(cp,outname,T_OCT); - if (system(buf)) { /* create octree */ + if (fdate(inpname) > fdate(outname) && + system(buf)) { /* create octree */ fclose(outfp); return(-1); }