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)) |
677 |
|
else |
678 |
|
fprintf(out, "5 "); |
679 |
|
fprintf(out, "%s %s source.cal ", |
680 |
< |
sinf->type==SPHERE ? "corr" : "flatcorr", |
680 |
> |
sinf->type==SPHERE ? "corr" : |
681 |
> |
sinf->type==DISK ? "cylcorr" : "boxcorr", |
682 |
|
libname(buf,name,T_DST)); |
683 |
|
if (pmtype == PM_B) { |
684 |
|
if (FEQ(bounds[1][0],0.)) |
701 |
|
} else |
702 |
|
fprintf(out, "src_theta "); |
703 |
|
} |
704 |
< |
fprintf(out, "\n0\n1 %g\n", sinf->mult); |
704 |
> |
if (sinf->type == SPHERE) |
705 |
> |
fprintf(out, "\n0\n1 %g\n", sinf->mult/sinf->area); |
706 |
> |
else if (sinf->type == DISK) |
707 |
> |
fprintf(out, "\n0\n3 %g %g %g\n", sinf->mult, |
708 |
> |
sinf->l, sinf->h); |
709 |
> |
else |
710 |
> |
fprintf(out, "\n0\n4 %g %g %g %g\n", sinf->mult, |
711 |
> |
sinf->l, sinf->w, sinf->h); |
712 |
|
if (putsource(sinf, out, id, filename(name), |
713 |
|
bounds[0][0]<90., bounds[0][1]>90.) != 0) |
714 |
|
return(-1); |
722 |
|
char *mod, *name; |
723 |
|
int dolower, doupper; |
724 |
|
{ |
725 |
< |
char buf[MAXWORD]; |
725 |
> |
int dosides = doupper && dolower && shp->h > MINDIM; |
726 |
> |
char lname[MAXWORD]; |
727 |
|
|
728 |
< |
fprintf(fp, "\n%s %s %s_light\n", mod, |
729 |
< |
shp->isillum ? "illum" : "light", |
730 |
< |
name); |
728 |
> |
strcat(strcpy(lname, name), "_light"); |
729 |
> |
fprintf(fp, "\n%s %s %s\n", mod, |
730 |
> |
shp->isillum ? "illum" : "light", lname); |
731 |
|
fprintf(fp, "0\n0\n3 %g %g %g\n", |
732 |
< |
lampcolor[0]/shp->area, |
722 |
< |
lampcolor[1]/shp->area, |
723 |
< |
lampcolor[2]/shp->area); |
724 |
< |
if (doupper && dolower && shp->type != SPHERE && shp->h > MINDIM) |
725 |
< |
if (shp->isillum) { |
726 |
< |
fprintf(fp, "\nvoid illum %s_glow\n", name); |
727 |
< |
fprintf(fp, "0\n0\n3 0 0 0\n"); |
728 |
< |
} else { |
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 |
< |
} |
732 |
> |
lampcolor[0], lampcolor[1], lampcolor[2]); |
733 |
|
switch (shp->type) { |
734 |
|
case RECT: |
737 |
– |
strcat(strcpy(buf, name), "_light"); |
735 |
|
if (dolower) |
736 |
< |
putrectsrc(shp, fp, buf, name, 0); |
736 |
> |
putrectsrc(shp, fp, lname, name, 0); |
737 |
|
if (doupper) |
738 |
< |
putrectsrc(shp, fp, buf, name, 1); |
739 |
< |
if (doupper && dolower && shp->h > MINDIM) { |
740 |
< |
strcat(strcpy(buf, name), "_glow"); |
744 |
< |
putsides(shp, fp, buf, name); |
745 |
< |
} |
738 |
> |
putrectsrc(shp, fp, lname, name, 1); |
739 |
> |
if (dosides) |
740 |
> |
putsides(shp, fp, lname, name); |
741 |
|
break; |
742 |
|
case DISK: |
748 |
– |
strcat(strcpy(buf, name), "_light"); |
743 |
|
if (dolower) |
744 |
< |
putdisksrc(shp, fp, buf, name, 0); |
744 |
> |
putdisksrc(shp, fp, lname, name, 0); |
745 |
|
if (doupper) |
746 |
< |
putdisksrc(shp, fp, buf, name, 1); |
747 |
< |
if (doupper && dolower && shp->h > MINDIM) { |
748 |
< |
strcat(strcpy(buf, name), "_glow"); |
755 |
< |
putcyl(shp, fp, buf, name); |
756 |
< |
} |
746 |
> |
putdisksrc(shp, fp, lname, name, 1); |
747 |
> |
if (dosides) |
748 |
> |
putcyl(shp, fp, lname, name); |
749 |
|
break; |
750 |
|
case SPHERE: |
751 |
< |
strcat(strcpy(buf, name), "_light"); |
760 |
< |
putspheresrc(shp, fp, buf, name); |
751 |
> |
putspheresrc(shp, fp, lname, name); |
752 |
|
break; |
753 |
|
} |
754 |
|
return(0); |
1039 |
|
strcpy(cp, "| oconv - > "); |
1040 |
|
cp += 12; |
1041 |
|
fullname(cp,outname,T_OCT); |
1042 |
< |
if (system(buf)) { /* create octree */ |
1042 |
> |
if (fdate(inpname) > fdate(outname) && |
1043 |
> |
system(buf)) { /* create octree */ |
1044 |
|
fclose(outfp); |
1045 |
|
return(-1); |
1046 |
|
} |