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.13 by gregl, Thu Dec 11 17:26:55 1997 UTC vs.
Revision 3.18 by gregl, Tue Jan 6 15:08:50 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 13 | Line 13 | static char SCCSid[] = "$SunId$ SGI";
13   #include "rhdriver.h"
14  
15   #ifndef MAXDIST
16 < #define MAXDIST         13      /* maximum distance outside section */
16 > #define MAXDIST         42      /* maximum distance outside section */
17   #endif
18  
19   extern GCOORD   *getviewcells();
# Line 94 | Line 94 | register struct beamcomp       *cb1, *cb2;
94  
95          if (!cb1->wants)                /* put orphans at the end, unsorted */
96                  return(cb2->wants);
97 +        if (!cb2->wants)
98 +                return(-1);
99          if ((c = cb1->bi - cb2->bi))    /* sort on beam index first */
100                  return(c);
101          return(cb1->hd - cb2->hd);      /* use hd to resolve matches */
# Line 162 | Line 164 | int    adopt;
164   }
165  
166  
165 cbeamadj(v, hr, vr)             /* adjust our beam list */
166 VIEW    *v;
167 int     hr, vr;
168 {
169        register PACKHEAD       *pa;
170        register int    i;
171        int     n;
172                                        /* first handle additions */
173        pa = (PACKHEAD *)malloc(xcbeams*sizeof(PACKHEAD));
174        if (xcbeams && pa == NULL)
175                goto memerr;
176        for (i = xcbeams; i--; ) {
177                pa[i].hd = cbeam[ncbeams+i].hd;
178                pa[i].bi = cbeam[ncbeams+i].bi;
179                pa[i].nr = npixels(v, hr, vr, hdlist[pa[i].hd], pa[i].bi) + 1;
180        }
181        n = xcbeams;                    /* now sort list for deletions */
182        cbeamsort(0);
183        pa = (PACKHEAD *)realloc((char *)pa, (n+xcbeams)*sizeof(PACKHEAD));
184        if (n+xcbeams && pa == NULL)
185                goto memerr;
186        for (i = xcbeams; i--; ) {
187                pa[n+i].hd = cbeam[ncbeams+i].hd;
188                pa[n+i].bi = cbeam[ncbeams+i].bi;
189                pa[n+i].nr = 0;
190        }
191        n += xcbeams;
192        xcbeams = 0;                    /* delete orphans */
193        serv_request(DR_ADJSET, n*sizeof(PACKHEAD), (char *)pa);
194        free((char *)pa);
195        return;
196 memerr:
197        error(SYSTEM, "out of memory in cbeamadj");
198 }
199
200
167   cbeamop(op, bl, n, v, hr, vr)   /* update beams on server list */
168   int     op;
169   register struct beamcomp        *bl;
# Line 218 | Line 184 | int    hr, vr;
184                  pa[i].bi = bl[i].bi;
185                  pa[i].nr = v==NULL ? 0 :
186                                  npixels(v, hr, vr, hdlist[bl[i].hd], bl[i].bi);
187 +                pa[i].nc = 0;
188          }
189          serv_request(op, n*sizeof(PACKHEAD), (char *)pa);
190          free((char *)pa);
# Line 268 | Line 235 | get_voxels(vl, vp)     /* find voxels corresponding to vie
235   VOXL    vl[8];
236   FVECT   vp;
237   {
271        static int      lastn = 0, lastd = -1;
238          int     n = 0;
239          FVECT   gp;
240          double  d;
# Line 304 | Line 270 | FVECT  vp;
270                  error(COMMAND, "move past outer limits");
271                  return(0);
272          }
273 <                                        /* warn of dangerous moves */
308 <        if (n < lastn && bestd >= lastd)
309 <                error(WARNING, "moving outside holodeck section");
310 <        else if (n > lastn && bestd <= lastd)
311 <                error(WARNING, "moving inside holodeck section");
312 <        lastd = bestd;
313 <        return(lastn = n);
273 >        return(n);
274   }
275  
276  
# Line 362 | Line 322 | register struct cellact        *cap;
322          register int    i;
323                                  /* compute cell center */
324          cgp[gcp->w>>1] = gcp->w&1 ? hp->grid[gcp->w>>1] : 0 ;
325 <        cgp[((gcp->w>>1)+1)%3] = gcp->i[0] + .5;
326 <        cgp[((gcp->w>>1)+2)%3] = gcp->i[1] + .5;
325 >        cgp[hdwg0[gcp->w]] = gcp->i[0] + .5;
326 >        cgp[hdwg1[gcp->w]] = gcp->i[1] + .5;
327          hdworld(org, hp, cgp);
328                                  /* compute direction to voxel center */
329          for (i = 3; i--; )
# Line 390 | Line 350 | register struct cellact        *cap;
350          for (i = 3; i--; )
351                  v1[i] = hp->xv[j][i] * d;
352          d = 0.5/hp->grid[j=(axmax+2)%3];
353 <        if (DOT(hp->wn[axmax], vc) < 0.)
354 <                d = -d; /* reverse vertex ordering */
353 >        if (DOT(hp->wg[axmax], vc) < 0.)
354 >                d = -d; /* reverse vertex order */
355          for (i = 3; i--; )
356                  v2[i] = hp->xv[j][i] * d;
357                                  /* compute voxel pyramid */
# Line 507 | Line 467 | VIEW   *vn;
467                          mvview(ca.vi, &dvw, vn);
468                  else                    /* else add all new cells */
469                          doview(&ca, vn);
510 #if 1
511        cbeamadj(vn, odev.hres, odev.vres);
512 #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 517 | 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 */
520 #endif
477          copystruct(&dvw, vn);           /* record new view */
478          return(1);
479   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines