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

Comparing ray/src/rt/rv2.c (file contents):
Revision 2.42 by schorsch, Mon Jul 21 22:30:19 2003 UTC vs.
Revision 2.44 by greg, Tue Jan 18 00:33:16 2005 UTC

# Line 14 | Line 14 | static const char      RCSid[] = "$Id$";
14  
15   #include  "platform.h"
16   #include  "ray.h"
17 + #include  "ambient.h"
18   #include  "otypes.h"
19   #include  "rpaint.h"
20  
# Line 34 | Line 35 | extern char  *progname;
35   extern char  *octname;
36  
37  
38 < void
39 < getframe(s)                             /* get a new frame */
40 < char  *s;
38 > extern void
39 > getframe(                               /* get a new frame */
40 >        char  *s
41 > )
42   {
43          if (getrect(s, &pframe) < 0)
44                  return;
# Line 44 | Line 46 | char  *s;
46   }
47  
48  
49 < void
50 < getrepaint(s)                           /* get area and repaint */
51 < char  *s;
49 > extern void
50 > getrepaint(                             /* get area and repaint */
51 >        char  *s
52 > )
53   {
54          RECT  box;
55  
# Line 56 | Line 59 | char  *s;
59   }
60  
61  
62 < void
63 < getview(s)                              /* get/show view parameters */
64 < char  *s;
62 > extern void
63 > getview(                                /* get/show view parameters */
64 >        char  *s
65 > )
66   {
67          FILE  *fp;
68          char  buf[128];
69          char  *fname;
70          int  change = 0;
71 <        VIEW  nv;
71 >        VIEW  nv = ourview;
72  
73          while (isspace(*s))
74                  s++;
75          if (*s == '-') {                        /* command line parameters */
72                nv = ourview;
76                  if (sscanview(&nv, s))
77                          newview(&nv);
78                  else
# Line 97 | Line 100 | char  *s;
100          if (buf[0] && buf[0] != ourview.type) {
101                  nv.type = buf[0];
102                  change++;
103 <        } else
101 <                nv.type = ourview.type;
103 >        }
104          sprintf(buf, "view point (%.6g %.6g %.6g): ",
105                          ourview.vp[0], ourview.vp[1], ourview.vp[2]);
106          (*dev->comout)(buf);
# Line 106 | Line 108 | char  *s;
108          if (buf[0] == CTRL('C')) return;
109          if (sscanvec(buf, nv.vp))
110                  change++;
109        else
110                VCOPY(nv.vp, ourview.vp);
111          sprintf(buf, "view direction (%.6g %.6g %.6g): ",
112                          ourview.vdir[0], ourview.vdir[1], ourview.vdir[2]);
113          (*dev->comout)(buf);
# Line 115 | Line 115 | char  *s;
115          if (buf[0] == CTRL('C')) return;
116          if (sscanvec(buf, nv.vdir))
117                  change++;
118        else
119                VCOPY(nv.vdir, ourview.vdir);
118          sprintf(buf, "view up (%.6g %.6g %.6g): ",
119                          ourview.vup[0], ourview.vup[1], ourview.vup[2]);
120          (*dev->comout)(buf);
# Line 124 | Line 122 | char  *s;
122          if (buf[0] == CTRL('C')) return;
123          if (sscanvec(buf, nv.vup))
124                  change++;
127        else
128                VCOPY(nv.vup, ourview.vup);
125          sprintf(buf, "view horiz and vert size (%.6g %.6g): ",
126                          ourview.horiz, ourview.vert);
127          (*dev->comout)(buf);
# Line 133 | Line 129 | char  *s;
129          if (buf[0] == CTRL('C')) return;
130          if (sscanf(buf, "%lf %lf", &nv.horiz, &nv.vert) == 2)
131                  change++;
136        else {
137                nv.horiz = ourview.horiz; nv.vert = ourview.vert;
138        }
132          sprintf(buf, "fore and aft clipping plane (%.6g %.6g): ",
133                          ourview.vfore, ourview.vaft);
134          (*dev->comout)(buf);
# Line 143 | Line 136 | char  *s;
136          if (buf[0] == CTRL('C')) return;
137          if (sscanf(buf, "%lf %lf", &nv.vfore, &nv.vaft) == 2)
138                  change++;
146        else {
147                nv.vfore = ourview.vfore; nv.vaft = ourview.vaft;
148        }
139          sprintf(buf, "view shift and lift (%.6g %.6g): ",
140                          ourview.hoff, ourview.voff);
141          (*dev->comout)(buf);
# Line 153 | Line 143 | char  *s;
143          if (buf[0] == CTRL('C')) return;
144          if (sscanf(buf, "%lf %lf", &nv.hoff, &nv.voff) == 2)
145                  change++;
156        else {
157                nv.hoff = ourview.hoff; nv.voff = ourview.voff;
158        }
146          if (change)
147                  newview(&nv);
148   }
149  
150  
151 < void
152 < lastview(s)                             /* return to a previous view */
153 < char  *s;
151 > extern void
152 > lastview(                               /* return to a previous view */
153 >        char  *s
154 > )
155   {
156          char  buf[128];
157          char  *fname;
# Line 195 | Line 183 | char  *s;
183   }
184  
185  
186 < void
187 < saveview(s)                             /* save view to rad file */
188 < char  *s;
186 > extern void
187 > saveview(                               /* save view to rad file */
188 >        char  *s
189 > )
190   {
191          char  view[64];
192          char  *fname;
# Line 232 | Line 221 | char  *s;
221   }
222  
223  
224 < void
225 < loadview(s)                             /* load view from rad file */
226 < char  *s;
224 > extern void
225 > loadview(                               /* load view from rad file */
226 >        char  *s
227 > )
228   {
229          char  buf[512];
230          char  *fname;
# Line 274 | Line 264 | char  *s;
264   }
265  
266  
267 < void
268 < getaim(s)                               /* aim camera */
269 < char  *s;
267 > extern void
268 > getaim(                         /* aim camera */
269 >        char  *s
270 > )
271   {
272 +        VIEW  nv = ourview;
273          double  zfact;
282        VIEW  nv;
274  
275          if (getinterest(s, 1, nv.vdir, &zfact) < 0)
276                  return;
286        nv.type = ourview.type;
287        VCOPY(nv.vp, ourview.vp);
288        VCOPY(nv.vup, ourview.vup);
289        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
290        nv.vfore = ourview.vfore; nv.vaft = ourview.vaft;
291        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
277          zoomview(&nv, zfact);
278          newview(&nv);
279   }
280  
281  
282 < void
283 < getmove(s)                              /* move camera */
284 < char  *s;
282 > extern void
283 > getmove(                                /* move camera */
284 >        char  *s
285 > )
286   {
287          FVECT  vc;
288          double  mag;
# Line 307 | Line 293 | char  *s;
293   }
294  
295  
296 < void
297 < getrotate(s)                            /* rotate camera */
298 < char  *s;
296 > extern void
297 > getrotate(                              /* rotate camera */
298 >        char  *s
299 > )
300   {
301 <        VIEW  nv;
301 >        VIEW  nv = ourview;
302          FVECT  v1;
303          double  angle, elev, zfact;
304          
# Line 320 | Line 307 | char  *s;
307                  error(COMMAND, "missing angle");
308                  return;
309          }
323        nv.type = ourview.type;
324        VCOPY(nv.vp, ourview.vp);
325        VCOPY(nv.vup, ourview.vup);
326        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
327        nv.vfore = ourview.vfore; nv.vaft = ourview.vaft;
310          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
311          if (elev != 0.0) {
312                  fcross(v1, nv.vdir, ourview.vup);
313                  normalize(v1);
314                  spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
315          }
334        nv.horiz = ourview.horiz; nv.vert = ourview.vert;
316          zoomview(&nv, zfact);
317          newview(&nv);
318   }
319  
320  
321 < void
322 < getpivot(s)                             /* pivot viewpoint */
323 < register char  *s;
321 > extern void
322 > getpivot(                               /* pivot viewpoint */
323 >        register char  *s
324 > )
325   {
326          FVECT  vc;
327          double  angle, elev, mag;
# Line 355 | Line 337 | register char  *s;
337   }
338  
339  
340 < void
341 < getexposure(s)                          /* get new exposure */
342 < char  *s;
340 > extern void
341 > getexposure(                            /* get new exposure */
342 >        char  *s
343 > )
344   {
345          char  buf[128];
346          register char  *cp;
# Line 423 | Line 406 | char  *s;
406  
407   typedef union {int i; double d; COLOR C;}       *MyUptr;
408  
409 < int
410 < getparam(str, dsc, typ, p)              /* get variable from user */
411 < char  *str, *dsc;
412 < int  typ;
413 < void  *p;
409 > extern int
410 > getparam(               /* get variable from user */
411 >        char  *str,
412 >        char  *dsc,
413 >        int  typ,
414 >        void  *p
415 > )
416   {
417          register MyUptr  ptr = (MyUptr)p;
418          int  i0;
# Line 484 | Line 469 | void  *p;
469                  setcolor(ptr->C, d0, d1, d2);
470                  return(1);
471          }
472 +        return 0; /* nothing matched */
473   }
474  
475  
476 < void
477 < setparam(s)                             /* get/set program parameter */
478 < register char  *s;
476 > extern void
477 > setparam(                               /* get/set program parameter */
478 >        register char  *s
479 > )
480   {
481          char  buf[128];
482          
# Line 661 | Line 648 | badparam:
648   }
649  
650  
651 < void
651 > extern void
652   traceray(s)                             /* trace a single ray */
653   char  *s;
654   {
# Line 730 | Line 717 | char  *s;
717   }
718  
719  
720 < void
720 > extern void
721   writepict(s)                            /* write the picture to a file */
722   char  *s;
723   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines