| 24 |
|
{ |
| 25 |
|
register int i; |
| 26 |
|
|
| 27 |
+ |
if (issurface(obj->otype) && !strcmp(mod, VOIDID)) |
| 28 |
+ |
return; /* don't print void surfaces */ |
| 29 |
|
printf("\n%s %s %s", mod, ofun[obj->otype].funame, obj->oname); |
| 30 |
|
printf("\n%d", obj->oargs.nsargs); |
| 31 |
|
for (i = 0; i < obj->oargs.nsargs; i++) |
| 96 |
|
FVECT u, v, w; |
| 97 |
|
{ |
| 98 |
|
FILE *dfp; |
| 99 |
+ |
float col[3]; |
| 100 |
|
int i; |
| 101 |
|
|
| 102 |
|
if (il->flags & IL_COLDST) { |
| 103 |
|
printf("\n%s %s %s%s", VOIDID, ofun[PAT_CDATA].funame, |
| 104 |
|
il->matname, DSTSUF); |
| 105 |
< |
printf("\n9 red green blue"); |
| 105 |
> |
printf("\n9 h_red h_grn h_blu"); |
| 106 |
|
for (i = 0; i < 3; i++) { |
| 107 |
|
dfp = dfopen(il, DATORD[i]); |
| 108 |
|
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", |
| 115 |
|
} else { |
| 116 |
|
printf("\n%s %s %s%s", VOIDID, ofun[PAT_BDATA].funame, |
| 117 |
|
il->matname, DSTSUF); |
| 118 |
< |
printf("\n5 noneg"); |
| 118 |
> |
printf("\n5 h_gry"); |
| 119 |
|
dfp = dfopen(il, 0); |
| 120 |
|
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", 1.-.5/n, .5/n, n, |
| 121 |
|
0., 2.*PI, m+1); |
| 124 |
|
printf(" %s", dfname(il, 0)); |
| 125 |
|
} |
| 126 |
|
printf("\n\t%s il_alth il_azih", FNCFNM); |
| 127 |
< |
printf("\n0\n9\n"); |
| 127 |
> |
printf("\n0\n13\n"); |
| 128 |
> |
compavg(col, da, m, il->nsamps); |
| 129 |
> |
printf("\t%f\t%f\t%f\t%f\n", col[0]/il->col[0], |
| 130 |
> |
col[1]/il->col[1], col[2]/il->col[2], 1.-.5/n); |
| 131 |
|
printf("\t%f\t%f\t%f\n", u[0], u[1], u[2]); |
| 132 |
|
printf("\t%f\t%f\t%f\n", v[0], v[1], v[2]); |
| 133 |
|
printf("\t%f\t%f\t%f\n", w[0], w[1], w[2]); |
| 141 |
|
int n, m; |
| 142 |
|
{ |
| 143 |
|
FILE *dfp; |
| 144 |
+ |
float col[3]; |
| 145 |
|
int i; |
| 146 |
|
|
| 147 |
|
if (il->flags & IL_COLDST) { |
| 148 |
|
printf("\n%s %s %s%s", VOIDID, ofun[PAT_CDATA].funame, |
| 149 |
|
il->matname, DSTSUF); |
| 150 |
< |
printf("\n9 red green blue"); |
| 150 |
> |
printf("\n9 s_red s_grn s_blu"); |
| 151 |
|
for (i = 0; i < 3; i++) { |
| 152 |
|
dfp = dfopen(il, DATORD[i]); |
| 153 |
|
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", |
| 160 |
|
} else { |
| 161 |
|
printf("\n%s %s %s%s", VOIDID, ofun[PAT_BDATA].funame, |
| 162 |
|
il->matname, DSTSUF); |
| 163 |
< |
printf("\n5 noneg"); |
| 163 |
> |
printf("\n5 s_gry"); |
| 164 |
|
dfp = dfopen(il, 0); |
| 165 |
|
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", 1.-1./n, -1.+1./n, n, |
| 166 |
|
0., 2.*PI, m+1); |
| 169 |
|
printf(" %s", dfname(il, 0)); |
| 170 |
|
} |
| 171 |
|
printf("\n\t%s il_alt il_azi", FNCFNM); |
| 172 |
< |
printf("\n0\n0\n"); |
| 172 |
> |
printf("\n0\n7\n"); |
| 173 |
> |
compavg(col, da, m, il->nsamps); /* north pole */ |
| 174 |
> |
printf("\t%f\t%f\t%f\n", col[0]/il->col[0], |
| 175 |
> |
col[1]/il->col[1], col[2]/il->col[2]); |
| 176 |
> |
compavg(col, da+(n-1)*m*3, m, il->nsamps); /* south pole */ |
| 177 |
> |
printf("\t%f\t%f\t%f\n", col[0]/il->col[0], |
| 178 |
> |
col[1]/il->col[1], col[2]/il->col[2]); |
| 179 |
> |
printf("\t%f\n", 1.-1./n); |
| 180 |
|
il->dfnum++; |
| 181 |
|
} |
| 182 |
|
|
| 210 |
|
} |
| 211 |
|
|
| 212 |
|
|
| 213 |
< |
average(il, da, n) /* compute average value for distribution */ |
| 214 |
< |
register struct illum_args *il; |
| 213 |
> |
compavg(col, da, n, ns) /* compute average for set of data values */ |
| 214 |
> |
float col[3]; |
| 215 |
|
register float *da; |
| 216 |
< |
int n; |
| 216 |
> |
int n, ns; |
| 217 |
|
{ |
| 218 |
|
register int i; |
| 219 |
|
|
| 220 |
< |
il->col[0] = il->col[1] = il->col[2] = 0.; |
| 220 |
> |
col[0] = col[1] = col[2] = 0.; |
| 221 |
|
i = n; |
| 222 |
|
while (i-- > 0) { |
| 223 |
< |
il->col[0] += *da++; |
| 224 |
< |
il->col[1] += *da++; |
| 225 |
< |
il->col[2] += *da++; |
| 223 |
> |
col[0] += *da++; |
| 224 |
> |
col[1] += *da++; |
| 225 |
> |
col[2] += *da++; |
| 226 |
|
} |
| 227 |
|
for (i = 0; i < 3; i++) |
| 228 |
< |
il->col[i] /= (double)n*il->nsamps; |
| 228 |
> |
col[i] /= (double)(n*ns); |
| 229 |
> |
} |
| 230 |
|
|
| 231 |
+ |
|
| 232 |
+ |
average(il, da, n) /* evaluate average value for distribution */ |
| 233 |
+ |
register struct illum_args *il; |
| 234 |
+ |
float *da; |
| 235 |
+ |
int n; |
| 236 |
+ |
{ |
| 237 |
+ |
compavg(il->col, da, n, il->nsamps); |
| 238 |
+ |
/* brighter than minimum? */ |
| 239 |
|
return(brt(il->col) > il->minbrt+FTINY); |
| 240 |
|
} |
| 241 |
|
|