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

Comparing ray/src/cv/bsdf2ttree.c (file contents):
Revision 2.52 by greg, Mon May 18 20:08:57 2020 UTC vs.
Revision 2.53 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 701 | Line 702 | wrap_up(void)
702   }
703   #endif
704  
705 + #define HEAD_BUFLEN     8192
706 + static char     head_buf[HEAD_BUFLEN];
707 + static int      cur_headlen = 0;
708 +
709 + /* Record header line as comment associated with this SIR input */
710 + static int
711 + record2header(char *s)
712 + {
713 +        int     len = strlen(s);
714 +
715 +        if (cur_headlen+len >= HEAD_BUFLEN-6)
716 +                return(0);
717 +                                        /* includes EOL */
718 +        strcpy(head_buf+cur_headlen, s);
719 +        cur_headlen += len;
720 +
721 +        return(1);
722 + }
723 +
724 + /* Finish off header for this file */
725 + static void
726 + done_header(void)
727 + {
728 +        while (cur_headlen > 0 && isspace(head_buf[cur_headlen-1]))
729 +                --cur_headlen;
730 +        head_buf[cur_headlen] = '\0';
731 +        if (!cur_headlen)
732 +                return;
733 +        add_wbsdf("-C", 1);
734 +        add_wbsdf(head_buf, 0);
735 +        head_buf[cur_headlen=0] = '\0';
736 + }
737 +
738   /* Read in BSDF and interpolate as tensor tree representation */
739   int
740   main(int argc, char *argv[])
# Line 841 | Line 875 | main(int argc, char *argv[])
875                                                  progname, argv[i]);
876                                  return(1);
877                          }
878 +                        sprintf(pbuf, "%s:\n", argv[i]);
879 +                        record2header(pbuf);
880 +                        sir_headshare = &record2header;
881                          if (!load_bsdf_rep(fpin))
882                                  return(1);
883                          fclose(fpin);
884 +                        done_header();
885                          sprintf(pbuf, "Interpolating component '%s'", argv[i]);
886                          prog_start(pbuf);
887                          if (!nbsdf++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines