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 2.8 by greg, Fri Jun 27 06:53:22 2003 UTC vs.
Revision 2.13 by greg, Fri Apr 11 20:27:23 2014 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7   *      9/21/90 Greg Ward
8   */
9  
10 + #include <X11/Xlib.h>
11 +
12   #include "standard.h"
13 + #include "paths.h"
14   #include "view.h"
12 #include <X11/Xlib.h>
15  
16   #define MAXDEPTH        32              /* ridiculous ray tree depth */
17  
18 < #ifdef  SMLFLT
17 < #define  sscanvec(s,v)  (sscanf(s,"%f %f %f",v,v+1,v+2)==3)
18 < #else
19 < #define  sscanvec(s,v)  (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3)
20 < #endif
18 > #define  sscanvec(s,v)  (sscanf(s,FVFORMAT,v,v+1,v+2)==3)
19  
20 < char    rtcom[] = "rtrace -h- -otp -fa -x 1";
20 > char    rtcom[64] = "rtrace -h- -otp -fa -x 1";
21   char    xicom[] = "ximage -c 256";
22  
23   VIEW    ourview = STDVIEW;              /* view for picture */
# Line 43 | Line 41 | struct node {                          /* ray tree node */
41  
42   int     slow = 0;               /* slow trace? */
43  
44 + void mainloop(void);
45 + static void freetree(struct node        *tp);
46 + static void tracerays(struct node       *tp);
47 + static int strtoipt(int ipt[2], char    *str);
48 + static void setvec(int  ipt[2]);
49 + static void vector(int  ip1[2], int     ip2[2]);
50  
51 < main(argc, argv)                /* takes both the octree and the image */
52 < int     argc;
53 < char    *argv[];
51 >
52 > int
53 > main(           /* takes both the octree and the image */
54 >        int     argc,
55 >        char    *argv[]
56 > )
57   {
58          int     i;
59 <        char    combuf[256];
59 >        char    combuf[PATH_MAX];
60  
61          progname = argv[0];
62          for (i = 1; i < argc-2; i++)
63                  if (!strcmp(argv[i], "-s"))
64                          slow++;
65 +                else if (!strcmp(argv[i], "-T"))
66 +                        strcat(rtcom, " -oTp");
67                  else
68                          break;
69          if (i > argc-2) {
70 <                fprintf(stderr, "Usage: %s [-s] [rtrace args] octree picture\n",
70 >                fprintf(stderr, "Usage: %s [-s][-T] [rtrace args] octree picture\n",
71                                  progname);
72                  exit(1);
73          }
# Line 78 | Line 87 | char   *argv[];
87                  exit(1);
88          }
89                                          /* build input command */
90 <        sprintf(combuf, "%s %s | %s", xicom, picture, rtcom);
90 >        sprintf(combuf, "%s \"%s\" | %s", xicom, picture, rtcom);
91          for ( ; i < argc-1; i++) {
92                  strcat(combuf, " ");
93                  strcat(combuf, argv[i]);
# Line 94 | Line 103 | char   *argv[];
103   }
104  
105  
106 < mainloop()                              /* get and process input */
106 > void
107 > mainloop(void)                          /* get and process input */
108   {
109          static struct node      *sis[MAXDEPTH];
110          register struct node    *newp;
# Line 133 | Line 143 | mainloop()                             /* get and process input */
143   }
144  
145  
146 < freetree(tp)                            /* free a trace tree */
147 < struct node     *tp;
146 > static void
147 > freetree(                               /* free a trace tree */
148 >        struct node     *tp
149 > )
150   {
151          register struct node    *kid, *k2;
152  
# Line 146 | Line 158 | struct node    *tp;
158   }
159  
160  
161 < tracerays(tp)                           /* trace a ray tree */
162 < struct node     *tp;
161 > static void
162 > tracerays(                              /* trace a ray tree */
163 >        struct node     *tp
164 > )
165   {
166          register struct node    *kid;
167  
# Line 158 | Line 172 | struct node    *tp;
172   }
173  
174  
175 < strtoipt(ipt, str)              /* convert string x y z to image point */
176 < int     ipt[2];
177 < char    *str;
175 > static int
176 > strtoipt(               /* convert string x y z to image point */
177 >        int     ipt[2],
178 >        char    *str
179 > )
180   {
181          FVECT   im_pt, pt;
182  
# Line 184 | Line 200 | Window gwind = 0;
200   int     xoff, yoff;
201  
202  
203 < setvec(ipt)                     /* set up vector drawing for pick */
204 < int     ipt[2];
203 > static void
204 > setvec(                 /* set up vector drawing for pick */
205 >        int     ipt[2]
206 > )
207   {
208          extern Window   xfindwind();
209          XWindowAttributes       wa;
# Line 224 | Line 242 | int    ipt[2];
242   }
243  
244  
245 < vector(ip1, ip2)                /* draw a vector */
246 < int     ip1[2], ip2[2];
245 > static void
246 > vector(         /* draw a vector */
247 >        int     ip1[2],
248 >        int     ip2[2]
249 > )
250   {
251          if (ip2[0] == -1 && ip2[1] == -1)
252                  return;                 /* null vector */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines