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

Comparing ray/src/hd/rhpict.c (file contents):
Revision 3.9 by greg, Thu May 29 16:26:22 2003 UTC vs.
Revision 3.15 by greg, Mon Oct 20 16:01:55 2003 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Radiance holodeck picture generator
6   */
7  
8 + #include <string.h>
9 +
10   #include "rholo.h"
11 + #include "platform.h"
12   #include "view.h"
13  
14   char    *progname;              /* our program name */
# Line 54 | Line 57 | char   *argv[];
57                                  pixaspect = atof(argv[++i]);
58                          else if (argv[i][2] == 'e') {
59                                  expval = atof(argv[++i]);
60 <                                if (argv[i][0] == '-' | argv[i][0] == '+')
60 >                                if ((argv[i][0] == '-') | (argv[i][0] == '+'))
61                                          expval = pow(2., expval);
62                          } else
63                                  goto userr;
# Line 167 | Line 170 | render_frame(bl, nb)           /* render frame from beam values
170   register PACKHEAD       *bl;
171   int     nb;
172   {
173 <        extern int      pixBeam();
173 >        extern void     pixBeam();
174          register HDBEAMI        *bil;
175          register int    i;
176  
# Line 210 | Line 213 | int    fn;
213          fputs(VIEWSTR, stdout);
214          fprintview(&myview, stdout);
215          fputc('\n', stdout);
216 <        if (pa < 0.99 | pa > 1.01)
216 >        if ((pa < 0.99) | (pa > 1.01))
217                  fputaspect(pa, stdout);
218 <        if (expval < 0.99 | expval > 1.01)
218 >        if ((expval < 0.99) | (expval > 1.01))
219                  fputexpos(expval, stdout);
220          fputformat(COLRFMT, stdout);
221          fputc('\n', stdout);
222                                  /* write resolution (standard order) */
223          fprtresolu(hres, vres, stdout);
224                                  /* prepare image buffers */
225 <        bzero((char *)mypixel, hres*vres*sizeof(COLOR));
226 <        bzero((char *)myweight, hres*vres*sizeof(float));
227 <        bzero((char *)mydepth, hres*vres*sizeof(float));
225 >        memset((char *)mypixel, '\0', hres*vres*sizeof(COLOR));
226 >        memset((char *)myweight, '\0', hres*vres*sizeof(float));
227 >        memset((char *)mydepth, '\0', hres*vres*sizeof(float));
228   }
229  
230  
# Line 229 | Line 232 | int
232   endpicture()                    /* finish and write out pixels */
233   {
234          int     lastr = -1, nunrend = 0;
235 <        int4    lastp, lastrp;
236 <        register int4   p;
235 >        int32   lastp, lastrp;
236 >        register int32  p;
237          register double d;
238                                  /* compute final pixel values */
239          for (p = hres*vres; p--; ) {
240                  if (myweight[p] <= FTINY) {
241 <                        if (lastr >= 0)
241 >                        if (lastr >= 0) {
242                                  if (p/hres == lastp/hres)
243                                          copycolor(mypixel[p], mypixel[lastp]);
244                                  else
245                                          copycolor(mypixel[p], mypixel[lastrp]);
246 +                        }
247                          nunrend++;
248                          continue;
249                  }
# Line 263 | Line 267 | initialize()                   /* initialize holodeck and buffers */
267          int     fd;
268          FILE    *fp;
269          int     n;
270 <        int4    nextloc;
270 >        int32   nextloc;
271                                          /* open holodeck file */
272          if ((fp = fopen(hdkfile, "r")) == NULL) {
273                  sprintf(errmsg, "cannot open \"%s\" for reading", hdkfile);
# Line 281 | Line 285 | initialize()                   /* initialize holodeck and buffers */
285          fd = dup(fileno(fp));                   /* dup file descriptor */
286          fclose(fp);                             /* done with stdio */
287          for (n = 0; nextloc > 0L; n++) {        /* initialize each section */
288 <                lseek(fd, (off_t)nextloc, 0);
288 >                lseek(fd, (off_t)nextloc, SEEK_SET);
289                  read(fd, (char *)&nextloc, sizeof(nextloc));
290                  hdinit(fd, NULL);
291          }
# Line 289 | Line 293 | initialize()                   /* initialize holodeck and buffers */
293          mypixel = (COLOR *)bmalloc(xres*yres*sizeof(COLOR));
294          myweight = (float *)bmalloc(xres*yres*sizeof(float));
295          mydepth = (float *)bmalloc(xres*yres*sizeof(float));
296 <        if (mypixel == NULL | myweight == NULL | mydepth == NULL)
296 >        if ((mypixel == NULL) | (myweight == NULL) | (mydepth == NULL))
297                  error(SYSTEM, "out of memory in initialize");
298   }
299  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines