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

Comparing ray/src/hd/rhdisp2.c (file contents):
Revision 3.3 by gregl, Thu Nov 20 18:06:35 1997 UTC vs.
Revision 3.4 by gregl, Fri Nov 21 16:10:17 1997 UTC

# Line 155 | Line 155 | int    adopt;
155   }
156  
157  
158 < cbeamadd(bl, n, v, hr, vr)      /* add beams to server list */
158 > cbeamop(op, bl, n, v, hr, vr)   /* update beams on server list */
159 > int     op;
160   register struct beamcomp        *bl;
161   int     n;
162   VIEW    *v;
# Line 169 | Line 170 | int    hr, vr;
170          pa = (PACKHEAD *)malloc(n*sizeof(PACKHEAD));
171          if (pa == NULL)
172                  error(SYSTEM, "out of memory in cbeamadd");
172        for (i = 0; i < n; i++)
173                pa[i].nr = npixels(v, hr, vr,
174                                hdlist[pa[i].hd=bl[i].hd],
175                                pa[i].bi=bl[i].bi) / 8;
176
177        serv_request(DR_ADDSET, n*sizeof(PACKHEAD), (char *)pa);
178        free((char *)pa);
179 }
180
181
182 cbeamdel(bl, n)         /* delete unwanted beam requests */
183 register struct beamcomp        *bl;
184 int     n;
185 {
186        register PACKHEAD       *pa;
187        register int    i;
188
189        if (n <= 0)
190                return;
191        pa = (PACKHEAD *)malloc(n*sizeof(PACKHEAD));
192        if (pa == NULL)
193                error(SYSTEM, "out of memory in cbeamdel");
173          for (i = 0; i < n; i++) {
174                  pa[i].hd = bl[i].hd;
175                  pa[i].bi = bl[i].bi;
176 <                pa[i].nr = 0;           /* removes any request */
176 >                pa[i].nr = v==NULL ? 0 :
177 >                                npixels(v, hr, vr, hdlist[bl[i].hd], bl[i].bi);
178          }
179 <        serv_request(DR_DELSET, n*sizeof(PACKHEAD), (char *)pa);
179 >        serv_request(op, n*sizeof(PACKHEAD), (char *)pa);
180          free((char *)pa);
181   }
182  
# Line 418 | Line 398 | VIEW   *vold, *vnew;
398   }
399  
400  
401 + beam_sync()             /* synchronize beams on server */
402 + {
403 +        cbeamop(DR_NEWSET, cbeam, ncbeams, &odev.v, odev.hres, odev.vres);
404 + }
405 +
406 +
407   beam_view(vo, vn)       /* change beam view */
408   VIEW    *vo, *vn;
409   {
# Line 427 | Line 413 | VIEW   *vo, *vn;
413  
414          if (!vn->type) {                /* clear our beam list */
415                  set_voxels(vlnew, 0);
416 <                cbeamdel(cbeam, ncbeams);
416 >                cbeamop(DR_DELSET, cbeam, ncbeams, NULL, 0, 0);
417                  ncbeams = 0;
418                  return;
419          }
# Line 444 | Line 430 | VIEW   *vo, *vn;
430                  else                    /* else add all new cells */
431                          doview(&ca, vn);
432                                          /* inform server of new beams */
433 <        cbeamadd(cbeam+ncbeams, xcbeams, vn, odev.hres, odev.vres);
433 >        cbeamop(DR_ADDSET, cbeam+ncbeams, xcbeams, vn, odev.hres, odev.vres);
434                                          /* sort list to put orphans at end */
435          cbeamsort(0);
436                                          /* tell server to delete orphans */
437 <        cbeamdel(cbeam+ncbeams, xcbeams);
437 >        cbeamop(DR_DELSET, cbeam+ncbeams, xcbeams, NULL, 0, 0);
438          xcbeams = 0;                    /* truncate our list */
439   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines