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

Comparing ray/src/hd/rhdisp.c (file contents):
Revision 3.35 by gwlarson, Wed Nov 11 16:58:51 1998 UTC vs.
Revision 3.36 by gwlarson, Thu Dec 10 10:45:54 1998 UTC

# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ SGI";
18   #define VIEWHISTLEN     4       /* number of remembered views */
19   #endif
20  
21 + #ifndef FSIZDEF
22 + #define FSIZDEF         0.125   /* default focus frame size */
23 + #endif
24 +
25   HOLO    *hdlist[HDMAX+1];       /* global holodeck list */
26  
27   char    cmdlist[DC_NCMDS][8] = DC_INIT;
# Line 88 | Line 92 | char   *argv[];
92                                  printview();
93                          if (inp & DFL(DC_LASTVIEW))
94                                  new_view(NULL);
95 +                        if (inp & DFL(DC_FOCUS))
96 +                                set_focus(odev_args);
97                          if (inp & DFL(DC_KILL)) {
98                                  serv_request(DR_KILL, 0, NULL);
99                                  pause = 0;
# Line 300 | Line 306 | again:
306   }
307  
308  
309 + set_focus(args)                 /* set focus frame */
310 + char    *args;
311 + {
312 +        double  hcent, vcent, hsiz, vsiz;
313 +        VIEW    *dv, vwfocus;
314 +        int     i, res[2];
315 +
316 +        i = sscanf(args, "%lf %lf %lf %lf", &hcent, &vcent, &hsiz, &vsiz);
317 +        if (i < 2 || hcent < 0 || hcent > 1 || vcent < 0 || vcent > 1) {
318 +                beam_init(0);                           /* restore view */
319 +                for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++)
320 +                        beam_view(dv, res[0], res[1]);
321 +                beam_sync(0);                           /* update server */
322 +                return;
323 +        }
324 +        if (i < 4 || hsiz <= hcent || hsiz > 1 || vsiz <= vcent || vsiz > 1)
325 +                hsiz = vsiz = FSIZDEF;                  /* gave center only */
326 +        else {
327 +                hsiz -= hcent; hcent += 0.5*hsiz;       /* gave min and max */
328 +                vsiz -= vcent; vcent += 0.5*vsiz;
329 +        }
330 +        beam_init(0);                                   /* add basic views */
331 +        for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++)
332 +                beam_view(dv, res[0]>>4, res[1]>>4);
333 +        copystruct(&vwfocus, &odev.v);                  /* add focus view */
334 +        switch (odev.v.type) {
335 +        case VT_PER:
336 +                vwfocus.horiz = 2.*180./PI*atan(
337 +                                hsiz * tan(PI/180./2.*odev.v.horiz) );
338 +                vwfocus.vert = 2.*180./PI*atan(
339 +                                vsiz * tan(PI/180./2.*odev.v.vert) );
340 +                break;
341 +        case VT_PAR:
342 +        case VT_ANG:
343 +                vwfocus.horiz = hsiz * odev.v.horiz;
344 +                vwfocus.vert = vsiz * odev.v.vert;
345 +                break;
346 +        case VT_HEM:
347 +                vwfocus.horiz = 2.*180./PI*asin(
348 +                                hsiz * sin(PI/180./2.*odev.v.horiz) );
349 +                vwfocus.vert = 2.*180./PI*asin(
350 +                                vsiz * sin(PI/180./2.*odev.v.vert) );
351 +                break;
352 +        case VT_CYL:
353 +                vwfocus.horiz = hsiz * odev.v.horiz;
354 +                vwfocus.vert = 2.*180./PI*atan(
355 +                                vsiz * tan(PI/180./2.*odev.v.vert) );
356 +                break;
357 +        default:
358 +                error(INTERNAL, "bad view type in set_focus");
359 +        }
360 +        vwfocus.hoff = (odev.v.hoff + hcent - 0.5)/hsiz;
361 +        vwfocus.voff = (odev.v.voff + vcent - 0.5)/vsiz;
362 +        setview(&vwfocus);
363 +        beam_view(&vwfocus, (int)(3*odev.hres*hsiz)+100,
364 +                        (int)(3*odev.vres*vsiz)+100);
365 +        beam_sync(0);                                   /* update server */
366 + }
367 +
368 +
369   int
370   usr_input()                     /* get user input and process it */
371   {
# Line 341 | Line 407 | usr_input()                    /* get user input and process it */
407                  break;
408          case DC_LASTVIEW:               /* restore previous view */
409                  new_view(NULL);
410 +                break;
411 +        case DC_FOCUS:                  /* set focus frame */
412 +                set_focus(args);
413                  break;
414          case DC_PAUSE:                  /* pause the current calculation */
415          case DC_RESUME:                 /* resume the calculation */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines