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

Comparing ray/src/hd/rholo2.c (file contents):
Revision 3.24 by schorsch, Mon Jun 30 14:59:12 2003 UTC vs.
Revision 3.30 by greg, Fri Oct 5 19:19:16 2018 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Rtrace support routines for holodeck rendering
6   */
7  
8 + #include <time.h>
9 +
10   #include "rholo.h"
11   #include "paths.h"
12   #include "random.h"
# Line 20 | Line 22 | struct gclim {
22          double  gmin[2], gmax[2];       /* grid coordinate limits */
23   };                              /* a grid coordinate range */
24  
25 + static void initeyelim(struct gclim     *gcl, HOLO      *hp, GCOORD     *gc);
26 + static void groweyelim(struct gclim *gcl, GCOORD *gc,
27 +                double r0, double r1, int tight);
28 + static int clipeyelim(short     rrng[2][2], struct gclim        *gcl);
29  
30 < static
31 < initeyelim(gcl, hp, gc)         /* initialize grid coordinate limits */
32 < register struct gclim   *gcl;
33 < register HOLO   *hp;
34 < GCOORD  *gc;
30 >
31 > static void
32 > initeyelim(             /* initialize grid coordinate limits */
33 >        struct gclim    *gcl,
34 >        HOLO    *hp,
35 >        GCOORD  *gc
36 > )
37   {
38 <        register RREAL  *v;
39 <        register int    i;
38 >        RREAL   *v;
39 >        int     i;
40  
41          if (hp != NULL) {
42                  hdgrid(gcl->egp, gcl->hp = hp, myeye.vpt);
# Line 38 | Line 46 | GCOORD *gc;
46                  gcl->erg2 *= (1./3.) * myeye.rng*myeye.rng;
47          }
48          if (gc != NULL)
49 <                copystruct(&gcl->gc, gc);
49 >                gcl->gc = *gc;
50          gcl->gmin[0] = gcl->gmin[1] = FHUGE;
51          gcl->gmax[0] = gcl->gmax[1] = -FHUGE;
52   }
53  
54  
55 < static
56 < groweyelim(gcl, gc, r0, r1, tight)      /* grow grid limits about eye point */
57 < register struct gclim   *gcl;
58 < GCOORD  *gc;
59 < double  r0, r1;
60 < int     tight;
55 > static void
56 > groweyelim(     /* grow grid limits about eye point */
57 >        struct gclim    *gcl,
58 >        GCOORD  *gc,
59 >        double  r0,
60 >        double  r1,
61 >        int     tight
62 > )
63   {
64          FVECT   gp, ab;
65          double  ab2, od, cfact;
# Line 97 | Line 107 | int    tight;
107          f = wallpos*(wallpos*sqcoef[gw] + licoef[gw]) + cnst;
108          for (i = 0; i < 2; i++) {
109                  if (i) {                /* swap x and y coefficients */
110 <                        register double t;
110 >                        double  t;
111                          t = a; a = c; c = t;
112                          t = d; d = e; e = t;
113                  }
# Line 106 | Line 116 | int    tight;
116                                  d*(c*d-b*e) + f*b*b);
117                  while (n-- > 0) {
118                          if (gc->w>>1 == gi[i] &&
119 <                                        (gc->w&1) ^ root[n] < gp[gc->w>>1]) {
119 >                                        (gc->w&1) ^ (root[n] < gp[gc->w>>1])) {
120                                  if (gc->w&1)
121                                          gcl->gmin[i] = -FHUGE;
122                                  else
# Line 132 | Line 142 | int    tight;
142                          n = quadratic(root, a, b*yex+d, yex*(yex*c+e)+f);
143                          while (n-- > 0) {
144                                  if (gc->w>>1 == gi[i] &&
145 <                                        (gc->w&1) ^ root[n] < gp[gc->w>>1])
145 >                                        (gc->w&1) ^ (root[n] < gp[gc->w>>1]))
146                                          continue;
147                                  if (root[n] < gcl->gmin[i])
148                                          gcl->gmin[i] = root[n];
# Line 145 | Line 155 | int    tight;
155  
156  
157   static int
158 < clipeyelim(rrng, gcl)           /* clip eye limits to grid cell */
159 < register short  rrng[2][2];
160 < register struct gclim   *gcl;
158 > clipeyelim(             /* clip eye limits to grid cell */
159 >        short   rrng[2][2],
160 >        struct gclim    *gcl
161 > )
162   {
163          int     incell = 1;
164 <        register int    i;
164 >        int     i;
165  
166          for (i = 0; i < 2; i++) {
167                  if (gcl->gmin[i] < gcl->gc.i[i])
# Line 170 | Line 181 | register struct gclim  *gcl;
181   }
182  
183  
184 < packrays(rod, p)                /* pack ray origins and directions */
185 < register float  *rod;
186 < register PACKET *p;
184 > void
185 > packrays(               /* pack ray origins and directions */
186 >        float   *rod,
187 >        PACKET  *p
188 > )
189   {
190   #if 0
191          double  dist2sum = 0.;
# Line 185 | Line 198 | register PACKET        *p;
198          GCOORD  gc[2];
199          FVECT   ro, rd;
200          double  d;
201 <        register int    i;
201 >        int     i;
202  
203          if (!hdbcoord(gc, hdlist[p->hd], p->bi))
204                  error(CONSISTENCY, "bad beam index in packrays");
# Line 252 | Line 265 | register PACKET        *p;
265   }
266  
267  
268 < donerays(p, rvl)                /* encode finished ray computations */
269 < register PACKET *p;
270 < register float  *rvl;
268 > void
269 > donerays(               /* encode finished ray computations */
270 >        PACKET  *p,
271 >        float   *rvl
272 > )
273   {
274          double  d;
275 <        register int    i;
275 >        int     i;
276  
277          for (i = 0; i < p->nr; i++) {
278                  setcolr(p->ra[i].v, rvl[0], rvl[1], rvl[2]);
# Line 272 | Line 287 | register float *rvl;
287  
288  
289   int
290 < done_rtrace()                   /* clean up and close rtrace calculation */
290 > done_rtrace(void)                       /* clean up and close rtrace calculation */
291   {
292          int     status;
293                                          /* already closed? */
294          if (!nprocs)
295 <                return;
295 >                return(0);
296                                          /* flush beam queue */
297          done_packets(flush_queue());
298                                          /* sync holodeck */
# Line 293 | Line 308 | done_rtrace()                  /* clean up and close rtrace calculati
308   }
309  
310  
311 < new_rtrace()                    /* restart rtrace calculation */
311 > void
312 > new_rtrace(void)                        /* restart rtrace calculation */
313   {
314          char    combuf[128];
315  
# Line 317 | Line 333 | new_rtrace()                   /* restart rtrace calculation */
333   }
334  
335  
336 < getradfile()                    /* run rad and get needed variables */
336 > int
337 > getradfile(void)                        /* run rad and get needed variables */
338   {
339          static short    mvar[] = {OCTREE,EYESEP,-1};
340          static char     tf1[] = TEMPLATE;
341          char    tf2[64];
342          char    combuf[256];
343 <        char    *pippt;
344 <        register int    i;
345 <        register char   *cp;
343 >        char    *pippt = NULL;
344 >        int     i;
345 >        char    *cp;
346                                          /* check if rad file specified */
347          if (!vdef(RIF))
348                  return(0);
# Line 359 | Line 376 | getradfile()                   /* run rad and get needed variables */
376                  loadvars(tf2);                  /* load variables */
377                  unlink(tf2);
378          }
379 <        rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */
379 >                                                /* get rtrace options */
380 >        rtargc += wordfile(rtargv+rtargc, MAXRTARGC-rtargc, tf1);
381          unlink(tf1);                    /* clean up */
382          return(1);
383   }
384  
385  
386 < report(t)                       /* report progress so far */
387 < time_t  t;
386 > void
387 > report(                 /* report progress so far */
388 >        time_t  t
389 > )
390   {
391          static time_t   seconds2go = 1000000;
392  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines