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.28 by greg, Sat Dec 28 18:05:14 2019 UTC vs.
Revision 2.29 by greg, Mon Oct 26 21:12:20 2020 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   #define _USE_MATH_DEFINES
11   #include <stdlib.h>
12   #include <math.h>
13 + #include <ctype.h>
14   #include "random.h"
15   #include "platform.h"
16   #include "paths.h"
# Line 575 | Line 576 | wrap_up(void)
576   }
577   #endif
578  
579 + #define HEAD_BUFLEN     8192
580 + static char     head_buf[HEAD_BUFLEN];
581 + static int      cur_headlen = 0;
582 +
583 + /* Record header line as comment associated with this SIR input */
584 + static int
585 + record2header(char *s)
586 + {
587 +        int     len = strlen(s);
588 +
589 +        if (cur_headlen+len >= HEAD_BUFLEN-6)
590 +                return(0);
591 +                                        /* includes EOL */
592 +        strcpy(head_buf+cur_headlen, s);
593 +        cur_headlen += len;
594 +
595 +        return(1);
596 + }
597 +
598 + /* Finish off header for this file */
599 + static void
600 + done_header(void)
601 + {
602 +        while (cur_headlen > 0 && isspace(head_buf[cur_headlen-1]))
603 +                --cur_headlen;
604 +        head_buf[cur_headlen] = '\0';
605 +        if (!cur_headlen)
606 +                return;
607 +        add_wbsdf("-C", 1);
608 +        add_wbsdf(head_buf, 0);
609 +        head_buf[cur_headlen=0] = '\0';
610 + }
611 +
612   /* Read in BSDF and interpolate as Klems matrix representation */
613   int
614   main(int argc, char *argv[])
# Line 699 | Line 733 | main(int argc, char *argv[])
733                                                  progname, argv[i]);
734                                  return(1);
735                          }
736 +                        sprintf(pbuf, "%s:\n", argv[i]);
737 +                        record2header(pbuf);
738 +                        sir_headshare = &record2header;
739                          if (!load_bsdf_rep(fpin))
740                                  return(1);
741                          fclose(fpin);
742 +                        done_header();
743                          sprintf(pbuf, "Interpolating component '%s'", argv[i]);
744                          prog_start(pbuf);
745                          eval_rbf();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines