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

Comparing ray/src/hd/rhd_x11.c (file contents):
Revision 3.24 by gregl, Tue Jan 6 13:07:57 1998 UTC vs.
Revision 3.29 by gwlarson, Fri Nov 13 14:25:52 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 10 | Line 10 | static char SCCSid[] = "$SunId$ SGI";
10   */
11  
12   #include "standard.h"
13 #include "rhd_qtree.h"
14
13   #include  <X11/Xlib.h>
14   #include  <X11/cursorfont.h>
15   #include  <X11/Xutil.h>
16 <
16 > #include "rhd_qtree.h"
17   #include  "x11icon.h"
18  
19   #ifndef RAYQLEN
# Line 265 | Line 263 | VIEW   *nv;
263   }
264  
265  
266 + dev_auxcom(cmd, args)           /* process an auxiliary command */
267 + char    *cmd, *args;
268 + {
269 +        sprintf(errmsg, "%s: unknown command", cmd);
270 +        error(COMMAND, errmsg);
271 + }
272 +
273 +
274 + VIEW *
275 + dev_auxview(n, hvres)           /* return nth auxiliary view */
276 + int     n;
277 + int     hvres[2];
278 + {
279 +        if (n)
280 +                return(NULL);
281 +        hvres[0] = odev.hres; hvres[1] = odev.vres;
282 +        return(&odev.v);
283 + }
284 +
285 +
286   int
287   dev_input()                     /* get X11 input */
288   {
# Line 273 | Line 291 | dev_input()                    /* get X11 input */
291          do
292                  getevent();
293  
294 <        while (XQLength(ourdisplay) > 0);
294 >        while (XPending(ourdisplay) > 0);
295  
296 +        odev.inpready = 0;
297 +
298          return(inpresflags);
299   }
300  
# Line 302 | Line 322 | dev_flush()                    /* flush output */
322   {
323          qtUpdate();
324          rayqleft = RAYQLEN;
325 <        return(XPending(ourdisplay));
325 >        return(odev.inpready = XPending(ourdisplay));
326   }
327  
328  
# Line 442 | Line 462 | ilclip(dp, wp)                 /* clip world coordinates to device *
462   int     dp[2][2];
463   FVECT   wp[2];
464   {
465 <        static FVECT    vmin = {0.,0.,0.}, vmax = {1.,1.,FHUGE};
466 <        FVECT   ip[2];
467 <                                /* not exactly right, but who cares? */
468 <        viewloc(ip[0], &odev.v, wp[0]);
469 <        viewloc(ip[1], &odev.v, wp[1]);
465 >        static FVECT    vmin = {0.,0.,0.}, vmax = {1.-FTINY,1.-FTINY,FHUGE};
466 >        FVECT   wpc[2], ip[2];
467 >        double  d, d0, d1;
468 >                                /* check for points behind view */
469 >        d = DOT(odev.v.vp, odev.v.vdir);
470 >        d0 = DOT(wp[0], odev.v.vdir) - d;
471 >        d1 = DOT(wp[1], odev.v.vdir) - d;
472 >                                /* work on copy of world points */
473 >        if (d0 <= d1) {
474 >                VCOPY(wpc[0], wp[0]); VCOPY(wpc[1], wp[1]);
475 >        } else {
476 >                d = d0; d0 = d1; d1 = d;
477 >                VCOPY(wpc[1], wp[0]); VCOPY(wpc[0], wp[1]);
478 >        }
479 >        if (d0 <= FTINY) {
480 >                if (d1 <= FTINY) return(0);
481 >                VSUB(wpc[0], wpc[0], wpc[1]);
482 >                d = .99*d1/(d1-d0);
483 >                VSUM(wpc[0], wpc[1], wpc[0], d);
484 >        }
485 >                                /* get view coordinates and clip to window */
486 >        viewloc(ip[0], &odev.v, wpc[0]);
487 >        viewloc(ip[1], &odev.v, wpc[1]);
488          if (!clip(ip[0], ip[1], vmin, vmax))
489                  return(0);
490          dp[0][0] = ip[0][0]*odev.hres;
# Line 477 | Line 515 | draw_grids()                   /* draw holodeck section grids */
515          static BYTE     gridrgb[3] = {0x0, 0xff, 0xff};
516          unsigned long  pixel;
517  
480        if (!mapped)
481                return;
518          if (ncolors > 0)
519                  pixel = pixval[get_pixel(gridrgb, xnewcolr)];
520          else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines