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

Comparing ray/src/util/rpiece.c (file contents):
Revision 2.56 by greg, Thu Dec 5 03:02:56 2013 UTC vs.
Revision 2.64 by greg, Wed Jul 3 17:18:17 2024 UTC

# Line 155 | Line 155 | main(
155                                          ++i;
156                                          continue;
157                                  }
158 +                                if (argv[i][2] == 'X') {
159 +                                        fprintf(stderr, "%s: -pXYZ unsupported\n",
160 +                                                argv[0]);
161 +                                        ++i;
162 +                                        continue;
163 +                                }
164 +                                if (argv[i][2] == 'c') {
165 +                                        fprintf(stderr, "%s: -pc unsupported\n",
166 +                                                argv[0]);
167 +                                        i += 9;
168 +                                        continue;
169 +                                }
170                                  if (argv[i][2] != 'a' || argv[i][3])
171                                          break;
172                                  pixaspect = atof(argv[++i]);
173                                  continue;
174 +                        case 'S':
175 +                                fprintf(stderr, "%s: -S unsupported\n", argv[0]);
176 +                                i++;
177 +                                continue;
178                          case 'T':               /* time limit (hours) */
179                                  if (argv[i][2])
180                                          break;
# Line 279 | Line 295 | init(                  /* set up output file and start rpict */
295          normaspect(viewaspect(&ourview)*hmult/vmult, &pixaspect, &hres, &vres);
296          if (!nowarn && (hr != hres*hmult) | (vr != vres*vmult))
297                  fprintf(stderr,
298 <                "%s: warning - resolution changed from %dx%d to %dx%d\n",
298 >                "%s: warning - changed resolution from %dx%d to %dx%d\n",
299                                  progname, hr, vr, hres*hmult, vres*vmult);
300          sprintf(hrbuf, "%d", hres);
301          rpargv[rpargc++] = "-x"; rpargv[rpargc++] = hrbuf;
302          sprintf(vrbuf, "%d", vres);
303          rpargv[rpargc++] = "-y"; rpargv[rpargc++] = vrbuf;
304          rpargv[rpargc++] = "-pa"; rpargv[rpargc++] = "0";
305 +        rpargv[rpargc++] = "-pm"; rpargv[rpargc++] = "0";
306          rpargv[rpargc++] = av[ac-1];
307          rpargv[rpargc] = NULL;
308                                          /* open output file */
# Line 298 | Line 315 | init(                  /* set up output file and start rpict */
315                  fprintf(fp, "SOFTWARE= %s\n", VersionID);
316                  fputs(VIEWSTR, fp);
317                  fprintview(&ourview, fp);
318 <                putc('\n', fp);
318 >                fputc('\n', fp);
319                  fputnow(fp);
320                  if (pixaspect < .99 || pixaspect > 1.01)
321                          fputaspect(pixaspect, fp);
322 +                fputprims(stdprims, fp);
323                  fputformat(COLRFMT, fp);
324 <                putc('\n', fp);
324 >                fputc('\n', fp);
325                  fprtresolu(hres*hmult, vres*vmult, fp);
326          } else if ((outfd = open(outfile, O_RDWR)) >= 0) {
327                  dolock(outfd, F_RDLCK);
# Line 326 | Line 344 | init(                  /* set up output file and start rpict */
344                  goto filerr;
345          dolock(outfd, F_UNLCK);
346                                          /* start rpict process */
347 +        rpd = sp_inactive;
348          if (open_process(&rpd, rpargv) <= 0) {
349                  fprintf(stderr, "%s: cannot start %s\n", progname, rpargv[0]);
350                  exit(1);
# Line 460 | Line 479 | cleanup(                       /* close rpict process and clean up */
479   static void
480   rpiece(void)                    /* render picture piece by piece */
481   {
482 +        char  *err;
483          VIEW  pview;
484          int  xorg, yorg;
465                                        /* compute view parameters */
466        pview = ourview;
467        switch (ourview.type) {
468        case VT_PER:
469                pview.horiz = (2.*180./PI)*atan(
470                                tan((PI/180./2.)*ourview.horiz)/hmult );
471                pview.vert = (2.*180./PI)*atan(
472                                tan((PI/180./2.)*ourview.vert)/vmult );
473                break;
474        case VT_PAR:
475        case VT_ANG:
476                pview.horiz = ourview.horiz / hmult;
477                pview.vert = ourview.vert / vmult;
478                break;
479        case VT_CYL:
480                pview.horiz = ourview.horiz / hmult;
481                pview.vert = (2.*180./PI)*atan(
482                                tan((PI/180./2.)*ourview.vert)/vmult );
483                break;
484        case VT_HEM:
485                pview.horiz = (2.*180./PI)*asin(
486                                sin((PI/180./2.)*ourview.horiz)/hmult );
487                pview.vert = (2.*180./PI)*asin(
488                                sin((PI/180./2.)*ourview.vert)/vmult );
489                break;
490        case VT_PLS:
491                pview.horiz = sin((PI/180./2.)*ourview.horiz) /
492                                (1.0 + cos((PI/180./2.)*ourview.horiz)) / hmult;
493                pview.horiz *= pview.horiz;
494                pview.horiz = (2.*180./PI)*acos((1. - pview.horiz) /
495                                                (1. + pview.horiz));
496                pview.vert = sin((PI/180./2.)*ourview.vert) /
497                                (1.0 + cos((PI/180./2.)*ourview.vert)) / vmult;
498                pview.vert *= pview.vert;
499                pview.vert = (2.*180./PI)*acos((1. - pview.vert) /
500                                                (1. + pview.vert));
501                break;
502        default:
503                fprintf(stderr, "%s: unknown view type '-vt%c'\n",
504                                progname, ourview.type);
505                exit(cleanup(1));
506        }
485                                          /* render each piece */
486          while (nextpiece(&xorg, &yorg)) {
487 <                pview.hoff = ourview.hoff*hmult + xorg - 0.5*(hmult-1);
488 <                pview.voff = ourview.voff*vmult + yorg - 0.5*(vmult-1);
487 >                pview = ourview;
488 >                err = cropview(&pview, (double)xorg/hmult, (double)yorg/vmult,
489 >                                        (xorg+1.)/hmult, (yorg+1.)/vmult);
490 >                if (err != NULL) {
491 >                        fprintf(stderr, "%s: %s\n", progname, err);
492 >                        exit(cleanup(1));
493 >                }
494                  fputs(VIEWSTR, torp);
495                  fprintview(&pview, torp);
496 <                putc('\n', torp);
496 >                fputc('\n', torp);
497                  fflush(torp);                   /* assigns piece to rpict */
498                  putpiece(xorg, yorg);           /* place piece in output */
499          }
# Line 588 | Line 571 | int    ypos
571          if (lseek(outfd, (off_t)fls.l_start, SEEK_SET) < 0)
572                  filerr("seek");
573          if (hmult == 1) {
574 <                if (writebuf(outfd, (char *)pbuf,
574 >                if (writebuf(outfd, pbuf,
575                                  vr*hr*sizeof(COLR)) != vr*hr*sizeof(COLR))
576                          filerr("write");
577          } else
578                  for (y = 0; y < vr; y++) {
579 <                        if (writebuf(outfd, (char *)(pbuf+y*hr),
579 >                        if (writebuf(outfd, pbuf+y*hr,
580                                          hr*sizeof(COLR)) != hr*sizeof(COLR))
581                                  filerr("write");
582                          if (y < vr-1 && lseek(outfd,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines