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.19 by gregl, Wed Dec 24 16:56:00 1997 UTC vs.
Revision 3.27 by gwlarson, Wed Aug 19 17:43:08 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 18 | Line 18 | static char SCCSid[] = "$SunId$ SGI";
18  
19   #include  "x11icon.h"
20  
21 + #ifndef RAYQLEN
22 + #define RAYQLEN         50000           /* max. rays to queue before flush */
23 + #endif
24 +
25   #ifndef FEQ
26   #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
27   #endif
# Line 81 | Line 85 | mytmflags()                    /* figure out tone mapping flags */
85          for (cp = tail; *cp && *cp != '.'; cp++)
86                  ;
87          if (cp-tail == 3 && !strncmp(tail, "x11", 3))
88 <                return(TM_F_CAMERA);
88 >                return(TM_F_CAMERA|TM_F_NOSTDERR);
89          if (cp-tail == 4 && !strncmp(tail, "x11h", 4))
90 <                return(TM_F_HUMAN);
90 >                return(TM_F_HUMAN|TM_F_NOSTDERR);
91          error(USER, "illegal driver name");
92   }
93  
# Line 92 | Line 96 | dev_open(id)                   /* initialize X11 driver */
96   char  *id;
97   {
98          extern char  *getenv();
99 <        char  *gv;
99 >        static RGBPRIMS myprims = STDPRIMS;
100 >        char  *ev;
101          double  gamval = GAMMA;
102 +        RGBPRIMP        dpri = stdprims;
103          int  nplanes;
104          XSetWindowAttributes    ourwinattr;
105          XWMHints  ourxwmhints;
# Line 126 | Line 132 | char  *id;
132                  ourwhite = WhitePixel(ourdisplay,ourscreen);
133          }
134                                          /* set gamma and tone mapping */
135 <        if ((gv = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL
136 <                        || (gv = getenv("DISPLAY_GAMMA")) != NULL)
137 <                gamval = atof(gv);
138 <        if (tmInit(mytmflags(), stdprims, gamval) == NULL)
135 >        if ((ev = XGetDefault(ourdisplay, "radiance", "gamma")) != NULL
136 >                        || (ev = getenv("DISPLAY_GAMMA")) != NULL)
137 >                gamval = atof(ev);
138 >        if ((ev = getenv("DISPLAY_PRIMARIES")) != NULL &&
139 >                        sscanf(ev, "%f %f %f %f %f %f %f %f",
140 >                                &myprims[RED][CIEX],&myprims[RED][CIEY],
141 >                                &myprims[GRN][CIEX],&myprims[GRN][CIEY],
142 >                                &myprims[BLU][CIEX],&myprims[BLU][CIEY],
143 >                                &myprims[WHT][CIEX],&myprims[WHT][CIEY]) >= 6)
144 >                dpri = myprims;
145 >        if (tmInit(mytmflags(), dpri, gamval) == NULL)
146                  error(SYSTEM, "not enough memory in dev_open");
147                                          /* open window */
148          ourwinattr.background_pixel = ourblack;
# Line 170 | Line 183 | char  *id;
183          dev_input();                    /* sets size and view angles */
184                                          /* allocate our leaf pile */
185          if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) *
186 <                        DisplayHeight(ourdisplay,ourscreen) /
187 <                        (qtMinNodesiz*qtMinNodesiz)))
186 >                        DisplayHeight(ourdisplay,ourscreen) * 3 /
187 >                        (qtMinNodesiz*qtMinNodesiz*2)))
188                  error(SYSTEM, "insufficient memory for leaf storage");
189          odev.name = id;
190          odev.ifd = ConnectionNumber(ourdisplay);
# Line 195 | Line 208 | dev_close()                    /* close our display */
208   }
209  
210  
211 +
212 + dev_clear()                     /* clear our quadtree */
213 + {
214 +        qtCompost(100);
215 +        if (ncolors > 0)
216 +                new_ctab(ncolors);
217 +        rayqleft = 0;                   /* hold off update */
218 + }
219 +
220 +
221   int
222   dev_view(nv)                    /* assign new driver view */
223   VIEW    *nv;
# Line 242 | Line 265 | VIEW   *nv;
265   }
266  
267  
268 + dev_auxcom(cmd, args)           /* process an auxiliary command */
269 + char    *cmd, *args;
270 + {
271 +        sprintf(errmsg, "%s: unknown command", cmd);
272 +        error(COMMAND, errmsg);
273 + }
274 +
275 +
276 + VIEW *
277 + dev_auxview(n, hvres)           /* return nth auxiliary view */
278 + int     n;
279 + int     hvres[2];
280 + {
281 +        if (n)
282 +                return(NULL);
283 +        hvres[0] = odev.hres; hvres[1] = odev.vres;
284 +        return(&odev.v);
285 + }
286 +
287 +
288   int
289   dev_input()                     /* get X11 input */
290   {
# Line 250 | Line 293 | dev_input()                    /* get X11 input */
293          do
294                  getevent();
295  
296 <        while (XQLength(ourdisplay) > 0);
296 >        while (XPending(ourdisplay) > 0);
297  
298 +        odev.inpready = 0;
299 +
300          return(inpresflags);
301   }
302  
# Line 278 | Line 323 | int
323   dev_flush()                     /* flush output */
324   {
325          qtUpdate();
326 <        return(XPending(ourdisplay));
326 >        rayqleft = RAYQLEN;
327 >        return(odev.inpready = XPending(ourdisplay));
328   }
329  
330  
# Line 599 | Line 645 | register XKeyPressedEvent  *ekey;
645                  if (ncolors > 0)
646                          new_ctab(ncolors);
647                  inpresflags |= DFL(DC_REDRAW);  /* resend values from server */
648 +                rayqleft = 0;                   /* hold off update */
649                  return;
650          case 'K':                       /* kill rtrace process(es) */
651                  inpresflags |= DFL(DC_KILL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines