ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/mkillum3.c
(Generate patch)

Comparing ray/src/gen/mkillum3.c (file contents):
Revision 2.11 by greg, Thu Sep 13 06:31:21 2007 UTC vs.
Revision 2.12 by greg, Thu Sep 13 17:52:35 2007 UTC

# Line 15 | Line 15 | char   DATSUF[] = ".dat";              /* data file suffix */
15   char    DSTSUF[] = ".dist";             /* distribution suffix */
16   char    FNCFNM[] = "illum.cal";         /* function file name */
17  
18 < void compinv(float *rinv, float *rp, int m);
19 < void colorout(int p, float *da, int n, int m, double mult, FILE *fp);
18 > void compinv(COLORV *rinv, COLORV *rp, int m);
19 > void colorout(int p, COLORV *da, int n, int m, double mult, FILE *fp);
20   void fputnum(double d, FILE *fp);
21 < void brightout(float *da, int n, int m, double mult, FILE *fp);
21 > void brightout(COLORV *da, int n, int m, double mult, FILE *fp);
22   void fputeol(FILE *fp);
23 < void compavg(float col[3], float *da, int n);
23 > void compavg(COLOR col, COLORV *da, int n);
24   char * dfname(struct illum_args *il, int c);
25   FILE * dfopen(struct illum_args *il, int c);
26  
# Line 102 | Line 102 | dfopen(                        /* open data file */
102   extern void
103   flatout(                /* write hemispherical distribution */
104          struct illum_args  *il,
105 <        float  *da,
105 >        COLORV  *da,
106          int  n,
107          int  m,
108          FVECT  u,
# Line 110 | Line 110 | flatout(               /* write hemispherical distribution */
110          FVECT  w
111   )
112   {
113 <        float  *Ninv;
113 >        COLORV  *Ninv;
114          FILE  *dfp;
115          int  i;
116  
117 <        if ((Ninv = (float *)malloc(3*m*sizeof(float))) == NULL)
117 >        if ((Ninv = (COLORV *)malloc(3*m*sizeof(COLORV))) == NULL)
118                  error(SYSTEM, "out of memory in flatout");
119          compinv(Ninv, da, m);
120          if (il->flags & IL_COLDST) {
# Line 159 | Line 159 | flatout(               /* write hemispherical distribution */
159   extern void
160   roundout(                       /* write spherical distribution */
161          struct illum_args  *il,
162 <        float  *da,
162 >        COLORV  *da,
163          int  n,
164          int  m
165   )
166   {
167 <        float  *Ninv, *Sinv;
167 >        COLORV  *Ninv, *Sinv;
168          FILE  *dfp;
169          int  i;
170  
171 <        if ((Ninv = (float *)malloc(3*m*sizeof(float))) == NULL ||
172 <                        (Sinv = (float *)malloc(3*m*sizeof(float))) == NULL)
171 >        if ((Ninv = (COLORV *)malloc(3*m*sizeof(COLORV))) == NULL ||
172 >                        (Sinv = (COLORV *)malloc(3*m*sizeof(COLORV))) == NULL)
173                  error(SYSTEM, "out of memory in roundout");
174          compinv(Ninv, da, m);
175          compinv(Sinv, da+3*m*(n-1), m);
# Line 245 | Line 245 | illumout(              /* print illum object */
245  
246   void
247   compavg(                /* compute average for set of data values */
248 <        float  col[3],
249 <        register float  *da,
248 >        COLOR  col,
249 >        register COLORV  *da,
250          int  n
251   )
252   {
253          register int  i;
254  
255 <        col[0] = col[1] = col[2] = 0.;
255 >        setcolor(col, 0.0, 0.0, 0.0);
256          i = n;
257          while (i-- > 0) {
258 <                col[0] += *da++;
259 <                col[1] += *da++;
260 <                col[2] += *da++;
258 >                addcolor(col, da);
259 >                da += 3;
260          }
261 <        for (i = 0; i < 3; i++)
263 <                col[i] /= (double)n;
261 >        scalecolor(col, 1./(double)n);
262   }
263  
264  
265   void
266   compinv(                /* compute other side of row average */
267 <        register float  *rinv,
268 <        register float  *rp,
267 >        register COLORV  *rinv,
268 >        register COLORV  *rp,
269          int  m
270   )
271   {
272 <        float  avg[3];
272 >        COLOR  avg;
273  
274          compavg(avg, rp, m);            /* row average */
275          while (m-- > 0) {
# Line 285 | Line 283 | compinv(               /* compute other side of row average */
283   extern int
284   average(                /* evaluate average value for distribution */
285          register struct illum_args  *il,
286 <        float  *da,
286 >        COLORV  *da,
287          int  n
288   )
289   {
# Line 327 | Line 325 | fputeol(                       /* write end of line to fp */
325   void
326   colorout(       /* put out color distribution data */
327          int  p,
328 <        register float  *da,
328 >        register COLORV  *da,
329          int  n,
330          int  m,
331          double  mult,
# Line 348 | Line 346 | colorout(      /* put out color distribution data */
346  
347   void
348   brightout(      /* put out brightness distribution data */
349 <        register float  *da,
349 >        register COLORV  *da,
350          int  n,
351          int  m,
352          double  mult,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines