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

Comparing ray/src/cv/bsdf2klems.c (file contents):
Revision 2.32 by greg, Fri Nov 13 19:21:11 2020 UTC vs.
Revision 2.38 by greg, Sat Jun 7 05:09:45 2025 UTC

# Line 12 | Line 12 | static const char RCSid[] = "$Id$";
12   #include <math.h>
13   #include <ctype.h>
14   #include "random.h"
15 #include "platform.h"
16 #include "paths.h"
15   #include "rtio.h"
16   #include "calcomp.h"
17   #include "bsdfrep.h"
# Line 22 | Line 20 | static const char RCSid[] = "$Id$";
20   enum {CIE_X, CIE_Y, CIE_Z};
21                                  /* assumed maximum # Klems patches */
22   #define MAXPATCHES      145
25                                /* global argv[0] */
26 char                    *progname;
23                                  /* selected basis function name */
24   static const char       klems_full[] = "LBNL/Klems Full";
25   static const char       klems_half[] = "LBNL/Klems Half";
# Line 196 | Line 192 | eval_bsdf(const char *fname)
192                      for (n = npsamps; n-- > 0; ) {
193                          fo_getvec(vout, j+(n+frandom())/npsamps, abp);
194                          fi_getvec(vin, i+urand(n), abp);
195 <                        ec = SDevalBSDF(&sdv, vout, vin, &bsd);
195 >                        ec = SDevalBSDF(&sdv, vin, vout, &bsd);
196                          if (ec != SDEnone)
197                                  goto err;
198                          sum += sdv.cieY;
# Line 245 | Line 241 | eval_bsdf(const char *fname)
241                      for (n = npsamps; n-- > 0; ) {
242                          bo_getvec(vout, j+(n+frandom())/npsamps, abp);
243                          bi_getvec(vin, i+urand(n), abp);
244 <                        ec = SDevalBSDF(&sdv, vout, vin, &bsd);
244 >                        ec = SDevalBSDF(&sdv, vin, vout, &bsd);
245                          if (ec != SDEnone)
246                                  goto err;
247                          sum += sdv.cieY;
# Line 277 | Line 273 | eval_bsdf(const char *fname)
273              }
274          }
275                                                  /* front transmission */
276 <        if (bsd.tf != NULL || bsd.tLamb.cieY > .002) {
276 >        if (bsd.tf != NULL || bsd.tLambFront.cieY > .002) {
277              input_orient = 1; output_orient = -1;
278              cfp[CIE_Y] = open_component_file(CIE_Y);
279              if (bsd.tf != NULL && bsd.tf->comp[0].cspec[2].flags) {
# Line 293 | Line 289 | eval_bsdf(const char *fname)
289                      for (n = npsamps; n-- > 0; ) {
290                          bo_getvec(vout, j+(n+frandom())/npsamps, abp);
291                          fi_getvec(vin, i+urand(n), abp);
292 <                        ec = SDevalBSDF(&sdv, vout, vin, &bsd);
292 >                        ec = SDevalBSDF(&sdv, vin, vout, &bsd);
293                          if (ec != SDEnone)
294                                  goto err;
295                          sum += sdv.cieY;
# Line 342 | Line 338 | eval_bsdf(const char *fname)
338                      for (n = npsamps; n-- > 0; ) {
339                          fo_getvec(vout, j+(n+frandom())/npsamps, abp);
340                          bi_getvec(vin, i+urand(n), abp);
341 <                        ec = SDevalBSDF(&sdv, vout, vin, &bsd);
341 >                        ec = SDevalBSDF(&sdv, vin, vout, &bsd);
342                          if (ec != SDEnone)
343                                  goto err;
344                          sum += sdv.cieY;
# Line 621 | Line 617 | main(int argc, char *argv[])
617          char    buf[1024];
618          char    *cp;
619          int     i, na;
620 <
621 <        progname = argv[0];
620 >                                                /* set global progname */
621 >        fixargv0(argv[0]);
622          esupport |= E_VARIABLE|E_FUNCTION|E_RCONST;
623          esupport &= ~(E_INCHAN|E_OUTCHAN);
624          scompile("PI:3.14159265358979323846", NULL, 0);
# Line 639 | Line 635 | main(int argc, char *argv[])
635                          single_plane_incident = 0;
636                          break;
637                  case 'f':
638 <                        if (!argv[i][2]) {
638 >                        if ((argv[i][0] == '-') & !argv[i][2]) {
639                                  if (strchr(argv[++i], '=') != NULL) {
640                                          add_wbsdf("-f", 1);
641                                          add_wbsdf(argv[i], 1);
# Line 700 | Line 696 | main(int argc, char *argv[])
696                          fprintf(stderr, "\tor 3 arguments using Dx,Dy,Dz: bsdf(ix,iy,iz)\n");
697                          goto userr;
698                  }
699 +                doptimize(1);                   /* optimize definitions */
700                  ++eclock;
701                  if (dofwd) {
702                          input_orient = -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines