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.16 by gregl, Tue Dec 16 11:57:32 1997 UTC vs.
Revision 3.17 by gregl, Thu Jan 1 13:00:16 1998 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1997 Silicon Graphics, Inc. */
1 > /* Copyright (c) 1998 Silicon Graphics, Inc. */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ SGI";
# Line 164 | Line 164 | int    adopt;
164   }
165  
166  
167 cbeamadj(v, hr, vr)             /* adjust our beam list */
168 VIEW    *v;
169 int     hr, vr;
170 {
171        PACKHEAD        *pa, *pa2;
172        register PACKHEAD       *pp;
173        int     n, n2;
174        FVECT   gp;
175        int     igp[3], vcflgs;
176        register int    i;
177                                        /* figure out center voxel(s) */
178        n = -1; vcflgs = 0;
179        for (i = 0; i < 8 && voxel[i].hd >= 0; i++) {
180                if (voxel[i].hd != n) {
181                        hdgrid(gp, hdlist[n=voxel[i].hd], v->vp);
182                        igp[0] = gp[0]; igp[1] = gp[1]; igp[2] = gp[2];
183                }
184                if (voxel[i].i[0] == igp[0] && voxel[i].i[1] == igp[1] &&
185                                voxel[i].i[2] == igp[2])
186                        vcflgs |= 1<<i;
187        }
188                                        /* get additions */
189        pa2 = (PACKHEAD *)malloc(xcbeams*sizeof(PACKHEAD));
190        if (xcbeams && pa2 == NULL)
191                goto memerr;
192        pa = pa2 + xcbeams; n2 = 0;
193        for (i = xcbeams; i--; ) {
194                if (cbeam[ncbeams+i].wants & vcflgs)
195                        pp = --pa;              /* priority list */
196                else
197                        pp = pa2 + n2++;        /* secondary list */
198                pp->hd = cbeam[ncbeams+i].hd;
199                pp->bi = cbeam[ncbeams+i].bi;
200                pp->nr = npixels(v, hr, vr, hdlist[pp->hd], pp->bi) + 1;
201                pp->nc = 0;
202        }
203        n = xcbeams - n2;
204                                        /* now sort list for deletions */
205        cbeamsort(0);
206        pa2 = (PACKHEAD *)realloc((char *)pa2, (n+n2+xcbeams)*sizeof(PACKHEAD));
207        if (n+n2+xcbeams && pa2 == NULL)
208                goto memerr;
209        pa = pa2 + n2;
210        for (i = xcbeams; i--; ) {
211                pp = pa + n++;
212                pp->hd = cbeam[ncbeams+i].hd;
213                pp->bi = cbeam[ncbeams+i].bi;
214                pp->nr = 0;
215                pp->nc = 0;
216        }
217        if (n)                          /* adjust the set */
218                serv_request(DR_ADJSET, n*sizeof(PACKHEAD), (char *)pa);
219        if (n2)                         /* make secondary additions */
220                serv_request(DR_ADDSET, n2*sizeof(PACKHEAD), (char *)pa2);
221        xcbeams = 0;                    /* clean up */
222        free((char *)pa2);
223        return;
224 memerr:
225        error(SYSTEM, "out of memory in cbeamadj");
226 }
227
228
167   cbeamop(op, bl, n, v, hr, vr)   /* update beams on server list */
168   int     op;
169   register struct beamcomp        *bl;
# Line 297 | Line 235 | get_voxels(vl, vp)     /* find voxels corresponding to vie
235   VOXL    vl[8];
236   FVECT   vp;
237   {
300        static int      lastn = 0, lastd = -1;
238          int     n = 0;
239          FVECT   gp;
240          double  d;
# Line 333 | Line 270 | FVECT  vp;
270                  error(COMMAND, "move past outer limits");
271                  return(0);
272          }
273 <                                        /* warn of dangerous moves */
337 <        if (n < lastn && bestd >= lastd)
338 <                error(WARNING, "moving outside holodeck section");
339 <        else if (n > lastn && bestd <= lastd)
340 <                error(WARNING, "moving inside holodeck section");
341 <        lastd = bestd;
342 <        return(lastn = n);
273 >        return(n);
274   }
275  
276  
# Line 536 | Line 467 | VIEW   *vn;
467                          mvview(ca.vi, &dvw, vn);
468                  else                    /* else add all new cells */
469                          doview(&ca, vn);
539 #if 1
540        cbeamadj(vn, odev.hres, odev.vres);
541 #else
470                                          /* inform server of new beams */
471          cbeamop(DR_ADDSET, cbeam+ncbeams, xcbeams, vn, odev.hres, odev.vres);
472                                          /* sort list to put orphans at end */
# Line 546 | Line 474 | VIEW   *vn;
474                                          /* tell server to delete orphans */
475          cbeamop(DR_DELSET, cbeam+ncbeams, xcbeams, NULL, 0, 0);
476          xcbeams = 0;                    /* truncate our list */
549 #endif
477          copystruct(&dvw, vn);           /* record new view */
478          return(1);
479   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines