12 |
|
|
13 |
|
#include <stdio.h> |
14 |
|
#include <math.h> |
15 |
+ |
#include <sys/types.h> |
16 |
|
#include <ctype.h> |
17 |
|
#include "color.h" |
18 |
|
#include "paths.h" |
128 |
|
*filename(), *libname(), *fullname(), *malloc(), |
129 |
|
*getword(), *atos(); |
130 |
|
extern float *matchlamp(); |
131 |
+ |
extern time_t fdate(); |
132 |
|
|
133 |
|
#define scnint(fp,ip) cvtint(ip,getword(fp)) |
134 |
|
#define scnflt(fp,rp) cvtflt(rp,getword(fp)) |
714 |
|
char *mod, *name; |
715 |
|
int dolower, doupper; |
716 |
|
{ |
717 |
+ |
int dosides = 0; |
718 |
|
char buf[MAXWORD]; |
719 |
|
|
720 |
|
fprintf(fp, "\n%s %s %s_light\n", mod, |
725 |
|
lampcolor[1]/shp->area, |
726 |
|
lampcolor[2]/shp->area); |
727 |
|
if (doupper && dolower && shp->type != SPHERE && shp->h > MINDIM) |
728 |
< |
if (shp->isillum) { |
726 |
< |
fprintf(fp, "\nvoid illum %s_glow\n", name); |
727 |
< |
fprintf(fp, "0\n0\n3 0 0 0\n"); |
728 |
< |
} else { |
728 |
> |
if (!shp->isillum) { |
729 |
|
fprintf(fp, "\n%s glow %s_glow\n", mod, name); |
730 |
|
fprintf(fp, "0\n0\n4 %g %g %g -1\n", |
731 |
|
lampcolor[0]/shp->area, |
732 |
|
lampcolor[1]/shp->area, |
733 |
|
lampcolor[2]/shp->area); |
734 |
+ |
dosides++; |
735 |
|
} |
736 |
|
switch (shp->type) { |
737 |
|
case RECT: |
740 |
|
putrectsrc(shp, fp, buf, name, 0); |
741 |
|
if (doupper) |
742 |
|
putrectsrc(shp, fp, buf, name, 1); |
743 |
< |
if (doupper && dolower && shp->h > MINDIM) { |
743 |
> |
if (dosides) { |
744 |
|
strcat(strcpy(buf, name), "_glow"); |
745 |
|
putsides(shp, fp, buf, name); |
746 |
|
} |
751 |
|
putdisksrc(shp, fp, buf, name, 0); |
752 |
|
if (doupper) |
753 |
|
putdisksrc(shp, fp, buf, name, 1); |
754 |
< |
if (doupper && dolower && shp->h > MINDIM) { |
754 |
> |
if (dosides) { |
755 |
|
strcat(strcpy(buf, name), "_glow"); |
756 |
|
putcyl(shp, fp, buf, name); |
757 |
|
} |
1049 |
|
strcpy(cp, "| oconv - > "); |
1050 |
|
cp += 12; |
1051 |
|
fullname(cp,outname,T_OCT); |
1052 |
< |
if (system(buf)) { /* create octree */ |
1052 |
> |
if (fdate(inpname) > fdate(outname) && |
1053 |
> |
system(buf)) { /* create octree */ |
1054 |
|
fclose(outfp); |
1055 |
|
return(-1); |
1056 |
|
} |