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

Comparing ray/src/rt/renderopts.c (file contents):
Revision 2.18 by greg, Mon Mar 21 19:06:08 2016 UTC vs.
Revision 2.19 by greg, Wed Oct 19 21:25:20 2022 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13   #include  "paths.h"
14   #include  "pmapopt.h"
15  
16 + extern char     *progname;      /* global argv[0] */
17 +
18 + char    RFeatureList[2048] =    /* newline-separated feature list */
19 +                "AdaptiveShadowTesting\nVirtualSources\nSecondarySources\n"
20 +                "SourceSubsampling\nSourceVisibility\nAmbientModifierSelection\n"
21 +                "PathTracing\nBackFaceVisibility\nRussianRoulette\nLowDiscrepancySeq\n"
22 +                "SpecularSampling\nMaterialMixtures\nAntimatter\n"
23 +                "ParticipatingMedia=Mist\nScatteringModels=WGMD,Ashikhmin-Shirley\n"
24 +                "TabulatedBSDFs=DataFile,KlemsXML,TensorTreeXML,+ViewPeakExtraction\n"
25 +                "Instancing=Octree,TriangleMesh\nAliases\n"
26 + #if !defined(SHADCACHE) || SHADCACHE > 0
27 +                "ShadowCache\n"
28 + #endif
29 + #ifdef  DISPERSE
30 +                "DielectricDispersion\n"
31 + #endif
32 + /*              PMAP_FEATURES   XXX @Roland: need to define this in pmapopt.h */
33 + ;
34 +
35 +
36 + static char *
37 + get_feature(            /* find a specific feature (with optional sublist) */
38 +        const char *feat
39 + )
40 + {
41 +        char    *cp = RFeatureList;
42 +        int     n = 0;
43 +
44 +        while ((feat[n] != '\0') & (feat[n] != '='))
45 +                n++;
46 +        if (!n)
47 +                return(NULL);
48 +        while (*cp) {
49 +                if (!strncmp(cp, feat, n) && (cp[n] == '\n') | !feat[n] | (cp[n] == feat[n]))
50 +                        return(cp);
51 +                while (*cp++ != '\n')
52 +                        ;
53 +        }
54 +        return(NULL);
55 + }
56 +
57 +
58 + static int
59 + match_subfeatures(      /* check if subfeatures are supported */
60 +        char *mysublist,
61 +        char *reqs
62 + )
63 + {
64 +        if (mysublist)
65 +                mysublist = strchr(mysublist, '=');
66 +        if (!mysublist++ | !reqs)
67 +                return(0);              /* not a feature list */
68 +        while (*reqs) {                 /* check each of their subfeature requests */
69 +                char    subfeat[64];
70 +                char    *cp = subfeat;
71 +                int     n;
72 +                while (*reqs && (*cp = *reqs++) != ',')
73 +                        cp++;
74 +                *cp = '\0';
75 +                n = cp - subfeat;
76 +                if (!(cp = strstr(mysublist, subfeat)) ||
77 +                                (cp[n] != ',') & (cp[n] != '\n'))
78 +                        return(0);      /* missing this one! */
79 +        }
80 +        return(1);                      /* matched them all */
81 + }
82 +
83 +
84 + int
85 + feature_status(         /* report active feature list / check specifics */
86 +        int  ac,
87 +        char  *av[]
88 + )
89 + {
90 +        if (ac <= 0)                    /* report entire list? */
91 +                fputs(RFeatureList, stdout);
92 +
93 +        for ( ; ac-- > 0; av++) {       /* check each argument */
94 +                char    *cp;
95 +                if (!*av[0]) continue;
96 +                if ((cp = strchr(av[0], '=')) != NULL) {
97 +                        if (!match_subfeatures(get_feature(av[0]), cp+1))
98 +                                goto missing_feature;
99 +                } else if ((cp = get_feature(av[0])) != NULL) {
100 +                        char    *tp = strchr(cp, '=');
101 +                        if (tp && tp < strchr(cp, '\n'))
102 +                                do
103 +                                        fputc(*cp, stdout);
104 +                                while (*cp++ != '\n');
105 +                } else
106 +                        goto missing_feature;
107 +        }
108 +        return(0);                      /* return satisfactory status */
109 + missing_feature:                        /* or report error */
110 +        fprintf(stderr, "%s: missing feature - %s\n", progname, av[0]);
111 +        return(1);
112 + }
113 +
114  
115   int
116   getrenderopt(           /* get next render option */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines