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.38 by greg, Sat Feb 22 02:07:29 2003 UTC vs.
Revision 2.43 by schorsch, Tue Mar 30 16:13:01 2004 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7   *  External symbols declared in rpaint.h
8   */
9  
10 < /* ====================================================================
11 < * The Radiance Software License, Version 1.0
12 < *
13 < * Copyright (c) 1990 - 2002 The Regents of the University of California,
14 < * through Lawrence Berkeley National Laboratory.   All rights reserved.
15 < *
16 < * Redistribution and use in source and binary forms, with or without
17 < * modification, are permitted provided that the following conditions
18 < * are met:
19 < *
20 < * 1. Redistributions of source code must retain the above copyright
21 < *         notice, this list of conditions and the following disclaimer.
22 < *
23 < * 2. Redistributions in binary form must reproduce the above copyright
24 < *       notice, this list of conditions and the following disclaimer in
25 < *       the documentation and/or other materials provided with the
26 < *       distribution.
27 < *
28 < * 3. The end-user documentation included with the redistribution,
29 < *           if any, must include the following acknowledgment:
30 < *             "This product includes Radiance software
31 < *                 (http://radsite.lbl.gov/)
32 < *                 developed by the Lawrence Berkeley National Laboratory
33 < *               (http://www.lbl.gov/)."
34 < *       Alternately, this acknowledgment may appear in the software itself,
35 < *       if and wherever such third-party acknowledgments normally appear.
36 < *
37 < * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
38 < *       and "The Regents of the University of California" must
39 < *       not be used to endorse or promote products derived from this
40 < *       software without prior written permission. For written
41 < *       permission, please contact [email protected].
42 < *
43 < * 5. Products derived from this software may not be called "Radiance",
44 < *       nor may "Radiance" appear in their name, without prior written
45 < *       permission of Lawrence Berkeley National Laboratory.
46 < *
47 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
48 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
49 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50 < * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
51 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
53 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
54 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
55 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
56 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
57 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 < * SUCH DAMAGE.
59 < * ====================================================================
60 < *
61 < * This software consists of voluntary contributions made by many
62 < * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
63 < * information on Lawrence Berkeley National Laboratory, please see
64 < * <http://www.lbl.gov/>.
65 < */
10 > #include "copyright.h"
11  
12 < #include  "ray.h"
12 > #include  <ctype.h>
13 > #include  <string.h>
14  
15 + #include  "platform.h"
16 + #include  "ray.h"
17 + #include  "ambient.h"
18   #include  "otypes.h"
70
19   #include  "rpaint.h"
20  
73 #include  <ctype.h>
74
21   extern int  psample;                    /* pixel sample size */
22   extern double  maxdiff;                 /* max. sample difference */
23  
# Line 89 | 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 99 | 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 111 | 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];
# Line 124 | Line 73 | char  *s;
73          while (isspace(*s))
74                  s++;
75          if (*s == '-') {                        /* command line parameters */
76 <                copystruct(&nv, &ourview);
76 >                nv = ourview;
77                  if (sscanview(&nv, s))
78                          newview(&nv);
79                  else
# Line 216 | Line 165 | char  *s;
165   }
166  
167  
168 < void
169 < lastview(s)                             /* return to a previous view */
170 < char  *s;
168 > extern void
169 > lastview(                               /* return to a previous view */
170 >        char  *s
171 > )
172   {
173          char  buf[128];
174          char  *fname;
# Line 226 | Line 176 | char  *s;
176          VIEW  nv;
177  
178          if (sscanf(s, "%s", buf) == 1) {        /* get parameters from a file */
179 <                copystruct(&nv, &stdview);
179 >                nv = stdview;
180                  if ((fname = getpath(buf, "", R_OK)) == NULL ||
181                                  (success = viewfile(fname, &nv, NULL)) == -1) {
182                          sprintf(errmsg, "cannot open \"%s\"", buf);
# Line 243 | Line 193 | char  *s;
193                  error(COMMAND, "no previous view");
194                  return;
195          }
196 <        copystruct(&nv, &ourview);
197 <        copystruct(&ourview, &oldview);
198 <        copystruct(&oldview, &nv);
196 >        nv = ourview;
197 >        ourview = oldview;
198 >        oldview = nv;
199          newimage();
200   }
201  
202  
203 < void
204 < saveview(s)                             /* save view to rad file */
205 < char  *s;
203 > extern void
204 > saveview(                               /* save view to rad file */
205 >        char  *s
206 > )
207   {
208          char  view[64];
209          char  *fname;
# Line 287 | Line 238 | char  *s;
238   }
239  
240  
241 < void
242 < loadview(s)                             /* load view from rad file */
243 < char  *s;
241 > extern void
242 > loadview(                               /* load view from rad file */
243 >        char  *s
244 > )
245   {
246          char  buf[512];
247          char  *fname;
# Line 320 | Line 272 | char  *s;
272          buf[0] = '\0';
273          fgets(buf, sizeof(buf), fp);
274          pclose(fp);
275 <        copystruct(&nv, &stdview);
275 >        nv = stdview;
276          if (!sscanview(&nv, buf)) {
277                  error(COMMAND, "rad error -- no such view?");
278                  return;
# Line 329 | Line 281 | char  *s;
281   }
282  
283  
284 < void
285 < getaim(s)                               /* aim camera */
286 < char  *s;
284 > extern void
285 > getaim(                         /* aim camera */
286 >        char  *s
287 > )
288   {
289          double  zfact;
290          VIEW  nv;
# Line 349 | Line 302 | char  *s;
302   }
303  
304  
305 < void
306 < getmove(s)                              /* move camera */
307 < char  *s;
305 > extern void
306 > getmove(                                /* move camera */
307 >        char  *s
308 > )
309   {
310          FVECT  vc;
311          double  mag;
# Line 362 | Line 316 | char  *s;
316   }
317  
318  
319 < void
320 < getrotate(s)                            /* rotate camera */
321 < char  *s;
319 > extern void
320 > getrotate(                              /* rotate camera */
321 >        char  *s
322 > )
323   {
324          VIEW  nv;
325          FVECT  v1;
# Line 392 | Line 347 | char  *s;
347   }
348  
349  
350 < void
351 < getpivot(s)                             /* pivot viewpoint */
352 < register char  *s;
350 > extern void
351 > getpivot(                               /* pivot viewpoint */
352 >        register char  *s
353 > )
354   {
355          FVECT  vc;
356          double  angle, elev, mag;
# Line 410 | Line 366 | register char  *s;
366   }
367  
368  
369 < void
370 < getexposure(s)                          /* get new exposure */
371 < char  *s;
369 > extern void
370 > getexposure(                            /* get new exposure */
371 >        char  *s
372 > )
373   {
374          char  buf[128];
375          register char  *cp;
# Line 478 | Line 435 | char  *s;
435  
436   typedef union {int i; double d; COLOR C;}       *MyUptr;
437  
438 < int
439 < getparam(str, dsc, typ, p)              /* get variable from user */
440 < char  *str, *dsc;
441 < int  typ;
442 < void  *p;
438 > extern int
439 > getparam(               /* get variable from user */
440 >        char  *str,
441 >        char  *dsc,
442 >        int  typ,
443 >        void  *p
444 > )
445   {
446          register MyUptr  ptr = (MyUptr)p;
447          int  i0;
# Line 519 | Line 478 | void  *p;
478                          (*dev->comout)(buf);
479                          (*dev->comin)(buf, NULL);
480                          if (buf[0] == '\0' ||
481 <                                        index("yY+1tTnN-0fF", buf[0]) == NULL)
481 >                                        strchr("yY+1tTnN-0fF", buf[0]) == NULL)
482                                  return(0);
483                  }
484 <                ptr->i = index("yY+1tT", buf[0]) != NULL;
484 >                ptr->i = strchr("yY+1tT", buf[0]) != NULL;
485                  return(1);
486          case 'C':                       /* color */
487                  if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) {
# Line 539 | Line 498 | void  *p;
498                  setcolor(ptr->C, d0, d1, d2);
499                  return(1);
500          }
501 +        return 0; /* nothing matched */
502   }
503  
504  
505 < void
506 < setparam(s)                             /* get/set program parameter */
507 < register char  *s;
505 > extern void
506 > setparam(                               /* get/set program parameter */
507 >        register char  *s
508 > )
509   {
510          char  buf[128];
511          
# Line 716 | Line 677 | badparam:
677   }
678  
679  
680 < void
680 > extern void
681   traceray(s)                             /* trace a single ray */
682   char  *s;
683   {
# Line 785 | Line 746 | char  *s;
746   }
747  
748  
749 < void
749 > extern void
750   writepict(s)                            /* write the picture to a file */
751   char  *s;
752   {
# Line 809 | Line 770 | char  *s;
770                  error(COMMAND, errmsg);
771                  return;
772          }
773 < #ifdef MSDOS
813 <        setmode(fileno(fp), O_BINARY);
814 < #endif
773 >        SET_FILE_BINARY(fp);
774          (*dev->comout)("writing \"");
775          (*dev->comout)(fname);
776          (*dev->comout)("\"...\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines