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

Comparing ray/src/hd/rhd_odraw.c (file contents):
Revision 3.16 by schorsch, Thu Jan 1 11:21:55 2004 UTC vs.
Revision 3.19 by greg, Fri Oct 5 19:19:16 2018 UTC

# Line 47 | Line 47 | static int     needmapping;    /* what needs doing with tone
47  
48  
49   #define SAMP32  (32*(2*sizeof(short)+sizeof(union ODfunion)+sizeof(TMbright)+\
50 <                        6*sizeof(BYTE))+sizeof(int32))
50 >                        6*sizeof(uby8))+sizeof(int32))
51  
52   static int sampcmp(const void *s0, const void *s1);
53   static int odAllocBlockSamp(int vn, int hh, int vh, double prox);
# Line 60 | Line 60 | static int blockedge(struct ODview *vp, int bi0, int b
60   static void odDrawSamp(int vn, int id);
61  
62  
63 < extern int
63 > int
64   odInit(                         /* initialize drawing routines */
65          int     n
66   )
# Line 102 | Line 102 | odInit(                                /* initialize drawing routines */
102                  odS.redraw = (int32 *)(odS.f + n);
103                  odS.ip = (short (*)[2])(odS.redraw + n/32);
104                  odS.brt = (TMbright *)(odS.ip + n);
105 <                odS.chr = (BYTE (*)[3])(odS.brt + n);
106 <                odS.rgb = (BYTE (*)[3])(odS.chr + n);
105 >                odS.chr = (uby8 (*)[3])(odS.brt + n);
106 >                odS.rgb = (uby8 (*)[3])(odS.chr + n);
107                  odS.nsamp = n;
108          }
109          if (!n)
# Line 174 | Line 174 | sampcmp(                       /* sample order, descending proximity */
174          const void      *s1
175   )
176   {
177 <        register double diff = odS.closeness(*(int*)s1) - odS.closeness(*(int*)s0);
177 >        double  diff = odS.closeness(*(int*)s1) - odS.closeness(*(int*)s0);
178  
179          return (diff > FTINY ? 1 : diff < -FTINY ? -1 : 0);
180   }
# Line 192 | Line 192 | odAllocBlockSamp(      /* allocate sample from block */
192          int     hl, vl;
193          VIEW    *vw;
194          int     res[2];
195 <        register struct ODblock *bp;
196 <        register int    i, j;
195 >        struct ODblock  *bp;
196 >        int     i, j;
197                                          /* get block */
198          hl = hh*odView[vn].hlow/odView[vn].hhi;
199          vl = vh*odView[vn].vlow/odView[vn].vhi;
# Line 261 | Line 261 | gotit:
261   }
262  
263  
264 < extern void
264 > void
265   odSample(                       /* add a sample value */
266          COLR    c,
267          FVECT   d,
# Line 270 | Line 270 | odSample(                      /* add a sample value */
270   {
271          FVECT   disp;
272          double  d0, d1, h, v, prox;
273 <        register VIEW   *vw;
273 >        VIEW    *vw;
274          int     hh, vh;
275          int     res[2];
276 <        register int    i, id;
276 >        int     i, id;
277  
278          DCHECK(odS.nsamp<=0, CONSISTENCY, "no samples allocated in odSample");
279                                                  /* add value to each view */
# Line 316 | Line 316 | odSample(                      /* add a sample value */
316                  if (id < 0)
317                          continue;               /* not good enough */
318                                                          /* convert color */
319 <                tmCvColrs(&odS.brt[id], odS.chr[id], (COLR *)c, 1);
319 >                tmCvColrs(tmGlobal, &odS.brt[id], odS.chr[id], (COLR *)c, 1);
320                  if (imm_mode | needmapping)             /* if immediate mode */
321                          needmapping |= NEWRGB;          /* map it later */
322                  else                                    /* else map it now */
323 <                        tmMapPixels(odS.rgb[id], &odS.brt[id], odS.chr[id], 1);
323 >                        tmMapPixels(tmGlobal, odS.rgb[id], &odS.brt[id],
324 >                                        odS.chr[id], 1);
325                  SET4(odS.redraw, id);                   /* mark for redraw */
326                  odView[i].n2redraw++;
327          }
328   }
329  
330  
331 < extern void
331 > void
332   odRemap(                        /* recompute tone mapping */
333          int     newhist
334   )
# Line 338 | Line 339 | odRemap(                       /* recompute tone mapping */
339   }
340  
341  
342 < extern void
342 > void
343   odRedrawAll(void)                               /* mark all samples for redraw */
344   {
345 <        register int    i;
345 >        int     i;
346  
347          if ((needmapping&(NEWMAP|NEWRGB)) == (NEWMAP|NEWRGB))
348                  return;                 /* will be called later, anyway */
# Line 354 | Line 355 | odRedrawAll(void)                              /* mark all samples for redraw */
355   }
356  
357  
358 < extern void
358 > void
359   odRedraw(       /* redraw view region */
360          int     vn,
361          int     hmin,
# Line 364 | Line 365 | odRedraw(      /* redraw view region */
365   )
366   {
367          int     i, j;
368 <        register struct ODblock *bp;
369 <        register int    k;
368 >        struct ODblock  *bp;
369 >        int     k;
370  
371          if ((vn<0) | (vn>=odNViews))
372                  return;
# Line 394 | Line 395 | odRedraw(      /* redraw view region */
395   }
396  
397  
398 < extern void
398 > void
399   odDepthMap(                     /* assign depth map for view */
400          int     vn,
401          GLfloat *dm
# Line 402 | Line 403 | odDepthMap(                    /* assign depth map for view */
403   {
404          double  d0, d1;
405          int     i, j, hmin, hmax, vmin, vmax;
406 <        register int    k, l;
406 >        int     k, l;
407  
408          if (dm == NULL) {                       /* free edge map */
409                  if ((vn<0) | (vn>=odNViews))
# Line 469 | Line 470 | odDepthMap(                    /* assign depth map for view */
470   }
471  
472  
473 < extern void
473 > void
474   odUpdate(                               /* update this view */
475          int     vn
476   )
477   {
478          static short    primes[] = {9431,6803,4177,2659,1609,887,587,251,47,1};
479          int     myprime;
480 <        register int    i, n;
480 >        int     i, n;
481  
482          DCHECK(vn<0 | vn>=odNViews, CONSISTENCY,
483                          "bad view number in odUpdate");
# Line 484 | Line 485 | odUpdate(                              /* update this view */
485          if (needmapping & NEWRGB) {
486                  if (needmapping & NEWMAP) {
487                          if (needmapping & NEWHIST)
488 <                                tmClearHisto();
488 >                                tmClearHisto(tmGlobal);
489                          needmapping &= ~NEWHIST;
490 <                        if (tmAddHisto(odS.brt,odS.nsamp,1) != TM_E_OK)
490 >                        if (tmAddHisto(tmGlobal, odS.brt,odS.nsamp,1) != TM_E_OK)
491                                  return;
492 <                        if (tmComputeMapping(0.,0.,0.) != TM_E_OK)
492 >                        if (tmComputeMapping(tmGlobal, 0.,0.,0.) != TM_E_OK)
493                                  return;
494                          needmapping &= ~NEWMAP;
495                          odRedrawAll();                  /* redraw everything */
496                  }
497 <                if (tmMapPixels((BYTE *)(odS.rgb), odS.brt,
498 <                                (BYTE *)(odS.chr), odS.nsamp) != TM_E_OK)
497 >                if (tmMapPixels(tmGlobal, (uby8 *)(odS.rgb), odS.brt,
498 >                                (uby8 *)(odS.chr), odS.nsamp) != TM_E_OK)
499                          return;
500                  needmapping &= ~NEWRGB;
501          }
# Line 552 | Line 553 | static
553   clip_end(p, o, vp)                      /* clip line segment to view */
554   GLshort p[3];
555   short   o[2];
556 < register struct ODview  *vp;
556 > struct ODview   *vp;
557   {
558          if (p[0] < 0) {
559                  p[1] = -o[0]*(p[1]-o[1])/(p[0]-o[0]) + o[1];
# Line 580 | Line 581 | static int
581   make_arms(              /* make arms for triangle fan */
582          GLshort ar[MAXFAN][3],
583          short   cp[2],
584 <        register struct ODview  *vp,
584 >        struct ODview   *vp,
585          double  sz
586   )
587   {
588          int     na, dv;
589          double  hrad, vrad, phi;
590 <        register int    i;
590 >        int     i;
591  
592          DCHECK(sz > 1, CONSISTENCY, "super-unary size in make_arms");
593          na = MAXFAN*sz + 0.5;                   /* keep arc length constant */
# Line 609 | Line 610 | make_arms(             /* make arms for triangle fan */
610  
611   static int
612   depthchange(            /* check depth discontinuity */
613 <        register struct ODview  *vp,
613 >        struct ODview   *vp,
614          int     x0,
615          int     y0,
616          int     x1,
617          int     y1
618   )
619   {
620 <        register double d0, d1;
620 >        double  d0, d1;
621  
622          DCHECK(x0<0 | x0>=vp->hhi | y0<0 | y0>=vp->vhi,
623                          CONSISTENCY, "coordinates off view in depthchange");
# Line 635 | Line 636 | static void
636   clip_edge(                      /* clip line segment to depth edge */
637          GLshort p[3],
638          short   o[2],
639 <        register struct ODview  *vp
639 >        struct ODview   *vp
640   )
641   {
642          int     x, y, xstep, ystep, rise, rise2, run, run2, n;
# Line 678 | Line 679 | clip_edge(                     /* clip line segment to depth edge */
679  
680   static int
681   getblock(                       /* get block index */
682 <        register struct ODview  *vp,
683 <        register int    h,
684 <        register int    v
682 >        struct ODview   *vp,
683 >        int     h,
684 >        int     v
685   )
686   {
687          if ((h<0) | (h>=vp->hhi) | (v<0) | (v>=vp->vhi))
# Line 691 | Line 692 | getblock(                      /* get block index */
692  
693   static int
694   blockedge(                      /* check for edge between blocks? */
695 <        register struct ODview  *vp,
696 <        register int    bi0,
697 <        register int    bi1
695 >        struct ODview   *vp,
696 >        int     bi0,
697 >        int     bi1
698   )
699   {
700          if (bi1 == bi0)
# Line 712 | Line 713 | blockedge(                     /* check for edge between blocks? */
713   static void
714   odDrawSamp(                     /* draw view sample */
715          int     vn,
716 <        register int    id
716 >        int     id
717   )
718   {
719          GLshort arm[MAXFAN][3];
720          int     narms, blockindex;
721 <        register struct ODview  *vp;
721 >        struct ODview   *vp;
722          double  size;
723          int     home_edges;
724 <        register int    i;
724 >        int     i;
725  
726          vp = odView + vn;
727          blockindex = getblock(vp, odS.ip[id][0], odS.ip[id][1]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines