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

Comparing ray/src/util/glaresrc.c (file contents):
Revision 2.3 by greg, Mon Jun 7 10:32:02 1993 UTC vs.
Revision 2.6 by greg, Mon May 29 16:47:54 2006 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Gather samples and compute glare sources.
6   */
# Line 17 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14   struct source   *curlist = NULL;        /* current source list */
15   struct source   *donelist = NULL;       /* finished sources */
16  
17 + void    pict_stats(void);
18  
19 < struct srcspan *
20 < newspan(l, r, v, sb)            /* allocate a new source span */
21 < int     l, r, v;
22 < float   *sb;
19 > static struct srcspan * newspan(int     l, int  r, int  v, float        *sb);
20 > static struct srcspan * newspan(int     l, int  r, int  v, float        *sb);
21 > static void addindirect(int     h, int  v, double       br);
22 > static void addsrcspan(struct srcspan   *nss);
23 > static void mergesource(struct source   *sp, struct source      *ap);
24 > static void close_sources(int   v);
25 > static void close_allsrcs(void);
26 > static struct srcspan * splitspan(register struct srcspan       *sso, double    h, double       v, double       m);
27 > static struct source * splitsource(struct source        *so);
28 > static void donesource(register struct source   *sp);
29 > static struct source * findbuddy(register struct source *s, register struct source      *l);
30 > static void absorb(register struct source       *s);
31 > static void freespans(struct source     *sp);
32 >
33 >
34 > static struct srcspan *
35 > newspan(                /* allocate a new source span */
36 >        int     l,
37 >        int     r,
38 >        int     v,
39 >        float   *sb
40 > )
41   {
42          register struct srcspan *ss;
43          register int    i;
# Line 39 | Line 55 | float  *sb;
55   }
56  
57  
58 < analyze()                       /* analyze our scene */
58 > extern void
59 > analyze(void)                   /* analyze our scene */
60   {
61          int     h, v;
62          int     left;
# Line 81 | Line 98 | analyze()                      /* analyze our scene */
98                  if (left < h)
99                          addsrcspan(newspan(left,h,v,spanbr));
100          }
101 <        free((char *)spanbr);
101 >        free((void *)spanbr);
102          close_allsrcs();
103   }
104  
105  
106 < addindirect(h, v, br)           /* add brightness to indirect illuminances */
107 < int     h, v;
108 < double  br;
106 > static void
107 > addindirect(            /* add brightness to indirect illuminances */
108 >        int     h,
109 >        int     v,
110 >        double  br
111 > )
112   {
113          double  tanb, d;
114          int     hl;
# Line 134 | Line 154 | double br;
154   }
155  
156  
157 < comp_thresh()                   /* compute glare threshold */
157 > extern void
158 > comp_thresh(void)                       /* compute glare threshold */
159   {
160          int     h, v;
161          int     nsamps;
# Line 173 | Line 194 | comp_thresh()                  /* compute glare threshold */
194   }
195  
196  
197 < addsrcspan(nss)                 /* add new source span to our list */
198 < struct srcspan  *nss;
197 > static void
198 > addsrcspan(                     /* add new source span to our list */
199 >        struct srcspan  *nss
200 > )
201   {
202          struct source   *last, *cs, *this;
203          register struct srcspan *ss;
# Line 211 | Line 234 | struct srcspan *nss;
234   }
235  
236  
237 < mergesource(sp, ap)             /* merge source ap into source sp */
238 < struct source   *sp, *ap;
237 > static void
238 > mergesource(            /* merge source ap into source sp */
239 >        struct source   *sp,
240 >        struct source   *ap
241 > )
242   {
243          struct srcspan  head;
244          register struct srcspan *alp, *prev, *tp;
# Line 241 | Line 267 | struct source  *sp, *ap;
267                  sp->brt = (sp->brt*sp->dom + ap->brt*ap->dom)
268                                  / (sp->dom + ap->dom);
269          }
270 <        free((char *)ap);
270 >        free((void *)ap);
271   }
272  
273  
274 < close_sources(v)                /* close sources above v */
275 < int     v;
274 > static void
275 > close_sources(          /* close sources above v */
276 >        int     v
277 > )
278   {
279          struct source   head;
280          register struct source  *last, *this;
# Line 264 | Line 292 | int    v;
292   }
293  
294  
295 < close_allsrcs()                 /* done with everything */
295 > static void
296 > close_allsrcs(void)                     /* done with everything */
297   {
298          register struct source  *this, *next;
299  
# Line 278 | Line 307 | close_allsrcs()                        /* done with everything */
307   }
308  
309  
310 < struct srcspan *
311 < splitspan(sso, h, v, m)         /* divide source span at point */
312 < register struct srcspan *sso;
313 < double  h, v, m;
310 > static struct srcspan *
311 > splitspan(              /* divide source span at point */
312 >        register struct srcspan *sso,
313 >        double  h,
314 >        double  v,
315 >        double  m
316 > )
317   {
318          register struct srcspan *ssn;
319          double  d;
# Line 306 | Line 338 | double h, v, m;
338   }
339  
340  
341 < struct source *
342 < splitsource(so)                 /* divide source in two if it's big and long */
343 < struct source   *so;
341 > static struct source *
342 > splitsource(                    /* divide source in two if it's big and long */
343 >        struct source   *so
344 > )
345   {
346          LRSUM   lr;
347          LRLIN   fit;
# Line 358 | Line 391 | struct source  *so;
391   }
392  
393  
394 < donesource(sp)                  /* finished with this source */
395 < register struct source  *sp;
394 > static void
395 > donesource(                     /* finished with this source */
396 >        register struct source  *sp
397 > )
398   {
399          struct source   *newsrc;
400          register struct srcspan *ss;
# Line 384 | Line 419 | register struct source *sp;
419          }
420          freespans(sp);
421          if (sp->dom <= FTINY) {         /* must be right at edge of image */
422 <                free((char *)sp);
422 >                free((void *)sp);
423                  return;
424          }
425          sp->brt /= (double)n;
# Line 399 | Line 434 | register struct source *sp;
434   }
435  
436  
437 < struct source *
438 < findbuddy(s, l)                 /* find close enough source to s in l*/
439 < register struct source  *s, *l;
437 > static struct source *
438 > findbuddy(                      /* find close enough source to s in l*/
439 >        register struct source  *s,
440 >        register struct source  *l
441 > )
442   {
443          struct source   *bestbuddy = NULL;
444          double  d, r, mindist = MAXBUDDY;
# Line 418 | Line 455 | register struct source *s, *l;
455   }
456  
457  
458 < absorb_specks()                 /* eliminate too-small sources */
458 > extern void
459 > absorb_specks(void)                     /* eliminate too-small sources */
460   {
461          struct source   head, *buddy;
462          register struct source  *last, *this;
# Line 442 | Line 480 | absorb_specks()                        /* eliminate too-small sources */
480   }
481  
482  
483 < absorb(s)                       /* absorb a source into indirect */
484 < register struct source  *s;
483 > static void
484 > absorb(                 /* absorb a source into indirect */
485 >        register struct source  *s
486 > )
487   {
488          FVECT   dir;
489          double  d;
# Line 458 | Line 498 | register struct source *s;
498                  indirect[i].n += d;
499          }
500          freespans(s);
501 <        free((char *)s);
501 >        free((void *)s);
502   }
503  
504  
505 < freespans(sp)                   /* free spans associated with source */
506 < struct source   *sp;
505 > static void
506 > freespans(                      /* free spans associated with source */
507 >        struct source   *sp
508 > )
509   {
510          register struct srcspan *ss;
511  
512          while ((ss = sp->first) != NULL) {
513                  sp->first = ss->next;
514 <                free((char *)ss);
514 >                free((void *)ss);
515          }
516   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines