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.54 by greg, Mon Oct 26 21:28:18 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 + #if defined(_WIN32) || defined(_WIN64)
722 +        if (head_buf[cur_headlen-1] == '\n')
723 +                head_buf[cur_headlen-1] = '\t';
724 + #endif
725 +        return(1);
726 + }
727 +
728 + /* Finish off header for this file */
729 + static void
730 + done_header(void)
731 + {
732 +        while (cur_headlen > 0 && isspace(head_buf[cur_headlen-1]))
733 +                --cur_headlen;
734 +        head_buf[cur_headlen] = '\0';
735 +        if (!cur_headlen)
736 +                return;
737 +        add_wbsdf("-C", 1);
738 +        add_wbsdf(head_buf, 0);
739 +        head_buf[cur_headlen=0] = '\0';
740 + }
741 +
742   /* Read in BSDF and interpolate as tensor tree representation */
743   int
744   main(int argc, char *argv[])
# Line 841 | Line 879 | main(int argc, char *argv[])
879                                                  progname, argv[i]);
880                                  return(1);
881                          }
882 +                        sprintf(pbuf, "%s:\n", argv[i]);
883 +                        record2header(pbuf);
884 +                        sir_headshare = &record2header;
885                          if (!load_bsdf_rep(fpin))
886                                  return(1);
887                          fclose(fpin);
888 +                        done_header();
889                          sprintf(pbuf, "Interpolating component '%s'", argv[i]);
890                          prog_start(pbuf);
891                          if (!nbsdf++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines