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

Comparing ray/src/hd/rholo3.c (file contents):
Revision 3.21 by gwlarson, Mon Feb 2 11:42:10 1998 UTC vs.
Revision 3.22 by gwlarson, Wed Jul 8 17:59:58 1998 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
3 #ifndef lint
4 static char SCCSid[] = "$SunId$ SGI";
5 #endif
6
1   /*
2   * Routines for tracking beam compuatations
3   */
# Line 62 | Line 56 | register PACKHEAD      *clist;
56   int     nents;
57   {
58          int     oldnr;
59 +        register HDBEAMI        *hb;
60          register int    i, n;
61                                  /* look for common members */
62          for (n = 0; n < nents; n++) {
# Line 117 | Line 112 | int    nents;
112                                          /* what can't we satisfy? */
113                  for (n = 0; n < nents && clist[n].nr > clist[n].nc; n++)
114                          ;
115 <                if (op == BS_ADJ)
116 <                        nents = n;
115 >                if (op == BS_ADJ) {     /* don't regenerate adjusted beams */
116 >                        for (i = n; i < nents && clist[i].nr > 0; i++)
117 >                                ;
118 >                        nents = i;
119 >                }
120                  if (n) {                /* allocate space for merged list */
121                          PACKHEAD        *newlist;
122                          newlist = (PACKHEAD *)malloc(
# Line 140 | Line 138 | int    nents;
138          default:
139                  error(CONSISTENCY, "bundle_set called with unknown operation");
140          }
141 <        if (outdev != NULL) {           /* load and display beams we have */
142 <                register HDBEAMI        *hb;
143 <
144 <                hb = (HDBEAMI *)malloc(nents*sizeof(HDBEAMI));
145 <                for (i = 0; i < nents; i++) {
146 <                        hb[i].h = hdlist[clist[i].hd];
147 <                        hb[i].b = clist[i].bi;
150 <                }
151 <                hdloadbeams(hb, nents, dispbeam);
152 <                free((char *)hb);
141 >        if (outdev == NULL)             /* nothing to display? */
142 >                return;
143 >                                        /* load and display beams we have */
144 >        hb = (HDBEAMI *)malloc(nents*sizeof(HDBEAMI));
145 >        for (i = 0; i < nents; i++) {
146 >                hb[i].h = hdlist[clist[i].hd];
147 >                hb[i].b = clist[i].bi;
148          }
149 +        hdloadbeams(hb, nents, dispbeam);
150 +        free((char *)hb);
151          return;
152   memerr:
153          error(SYSTEM, "out of memory in bundle_set");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines