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

Comparing ray/src/px/xshowtrace.c (file contents):
Revision 1.3 by greg, Mon Sep 24 12:21:06 1990 UTC vs.
Revision 2.1 by greg, Tue Nov 12 16:04:29 1991 UTC

# Line 1 | Line 1
1 + /* Copyright (c) 1991 Regents of the University of California */
2 +
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
5   #endif
# Line 14 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16  
17   #define MAXDEPTH        32              /* ridiculous ray tree depth */
18  
19 < char    rtcom[] = "rtrace -h -otp -fa -x 1";
20 < char    xicom[] = "x11image -f";
19 > char    rtcom[] = "rtrace -h- -otp -fa -x 1";
20 > char    xicom[] = "ximage";
21  
22   VIEW    ourview = STDVIEW;              /* view for picture */
23   int     xres, yres;
24  
25   char    *progname;                      /* program name */
26  
27 + char    *picture;                       /* picture name */
28 +
29   FILE    *pin;                           /* input stream */
30  
31   Display *theDisplay = NULL;             /* connection to server */
32  
33   struct node {                           /* ray tree node */
34 <        double  ipt[2];
34 >        FVECT   ipt;
35          struct node     *sister;
36          struct node     *daughter;
37   };
# Line 43 | Line 47 | char   *argv[];
47   {
48          int     i;
49          char    combuf[256];
46        Cursor  curs;
50  
51          progname = argv[0];
52          for (i = 1; i < argc-2; i++)
# Line 53 | Line 56 | char   *argv[];
56                          break;
57          if (i > argc-2) {
58                  fprintf(stderr, "Usage: %s [-s] [rtrace args] octree picture\n",
59 <                                argv[0]);
59 >                                progname);
60                  exit(1);
61          }
62 +        picture = argv[argc-1];
63                                          /* get the viewing parameters */
64 <        if (viewfile(argv[argc-1], &ourview, &xres, &yres) <= 0 ||
64 >        if (viewfile(picture, &ourview, &xres, &yres) <= 0 ||
65                          setview(&ourview) != NULL) {
66                  fprintf(stderr, "%s: cannot get view from \"%s\"\n",
67 <                                argv[0], argv[argc-1]);
67 >                                progname, picture);
68                  exit(1);
69          }
70                                          /* open the display */
71          if ((theDisplay = XOpenDisplay(NULL)) == NULL) {
72                  fprintf(stderr,
73                  "%s: cannot open display; DISPLAY variable set?\n",
74 <                                argv[0]);
74 >                                progname);
75                  exit(1);
76          }
77                                          /* build input command */
78 <        sprintf(combuf, "%s %s | %s", xicom, argv[argc-1], rtcom);
78 >        sprintf(combuf, "%s %s | %s", xicom, picture, rtcom);
79          for ( ; i < argc-1; i++) {
80                  strcat(combuf, " ");
81                  strcat(combuf, argv[i]);
# Line 149 | Line 153 | struct node    *tp;
153  
154  
155   strtoipt(ipt, str)              /* convert string x y z to image point */
156 < double  ipt[2];
156 > FVECT   ipt;
157   char    *str;
158   {
159          FVECT   pt;
160  
161          if (sscanf(str, "%lf %lf %lf", &pt[0], &pt[1], &pt[2]) != 3)
162                  return(-1);
163 <        viewpixel(&ipt[0], &ipt[1], NULL, &ourview, pt);
163 >        viewloc(ipt, &ourview, pt);
164          return(0);
165   }
166  
# Line 175 | Line 179 | double ipt[2];
179          XWindowAttributes       wa;
180          XColor  xc;
181          XGCValues       gcv;
182 <        int     pm, rx, ry, wx, wy, rw, cw;
182 >        int     rx, ry, wx, wy;
183 >        Window  rw, cw;
184 >        unsigned int    pm;
185                                          /* compute pointer location */
186 <        if (gwind == 0) {
187 <                XQueryPointer(theDisplay, rwind, &rw, &gwind,
188 <                                &rx, &ry, &wx, &wy, &pm);
186 >        if (gwind == 0 &&
187 >                (gwind = xfindwind(theDisplay, rwind, picture, 2)) == 0) {
188 >                fprintf(stderr, "%s: cannot find display window!\n", progname);
189 >                exit(1);
190          }
191 <        XQueryPointer(theDisplay, gwind, &rw, &cw,
185 <                        &rx, &ry, &wx, &wy, &pm);
191 >        XQueryPointer(theDisplay, gwind, &rw, &cw, &rx, &ry, &wx, &wy, &pm);
192          xoff = wx - ipt[0]*xres;
193          yoff = wy - (1.-ipt[1])*yres;
194                                          /* set graphics context */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines