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.17 by schorsch, Thu Mar 10 18:25:46 2016 UTC vs.
Revision 2.25 by greg, Fri Apr 5 17:52:20 2024 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 +                "VirtualSources\nSecondarySources\nSourceSubsampling\n"
20 +                "SourceVisibility\nAmbientModifierSelection\n"
21 +                "PathTracing\nRussianRoulette\nLowDiscrepancySeq\n"
22 +                "SpecularSampling\nMaterialMixtures\nAntimatter\nBackFaceVisibility\n"
23 +                "ScatteringModels=WGMD,Ashikhmin-Shirley\n"
24 +                "TabulatedBSDFs=DataFile,KlemsXML,TensorTreeXML,+ViewPeakExtraction\n"
25 +                "Instancing=Octree,TriangleMesh\nAliases\n"
26 + #if MAXCSAMP>3
27 +                "Hyperspectral\n"
28 + #endif
29 + #if !defined(SHADCACHE) || SHADCACHE > 0
30 +                "ShadowCache\n"
31 + #endif
32 + #ifdef  DISPERSE
33 +                "DielectricDispersion\n"
34 + #endif
35 + /*              PMAP_FEATURES   XXX @Roland: need to define this in pmapopt.h */
36 + ;
37 +
38 +
39 + static char *
40 + get_feature(            /* find a specific feature (with optional sublist) */
41 +        const char *feat
42 + )
43 + {
44 +        char    *cp = RFeatureList;
45 +        int     n = 0;
46 +
47 +        while ((feat[n] != '\0') & (feat[n] != '='))
48 +                n++;
49 +        if (!n)
50 +                return(NULL);
51 +        while (*cp) {
52 +                if (!strncmp(cp, feat, n) && (cp[n] == '\n') | !feat[n] | (cp[n] == feat[n]))
53 +                        return(cp);
54 +                while (*cp++ != '\n')
55 +                        ;
56 +        }
57 +        return(NULL);
58 + }
59 +
60 +
61 + static int
62 + match_subfeatures(      /* check if subfeatures are supported */
63 +        char *mysublist,
64 +        char *reqs
65 + )
66 + {
67 +        if (mysublist)
68 +                mysublist = strchr(mysublist, '=');
69 +        if (!mysublist++ | !reqs)
70 +                return(0);              /* not a feature list */
71 +        while (*reqs) {                 /* check each of their subfeature requests */
72 +                char    subfeat[64];
73 +                char    *cp = subfeat;
74 +                int     n;
75 +                while (*reqs && (*cp = *reqs++) != ',')
76 +                        cp++;
77 +                *cp = '\0';
78 +                n = cp - subfeat;
79 +                for (cp = mysublist; (cp = strstr(cp, subfeat)) != NULL; cp++)
80 +                        if ((cp[-1] == ',') | (cp[-1] == '=') &&
81 +                                        (cp[n] == ',') | (cp[n] == '\n'))
82 +                                break;  /* match */
83 +                if (!cp)
84 +                        return(0);      /* missing this one! */
85 +        }
86 +        return(1);                      /* matched them all */
87 + }
88 +
89 +
90   int
91 + feature_status(         /* report active feature list / check specifics */
92 +        int  ac,
93 +        char  *av[]
94 + )
95 + {
96 +        if (ac <= 0)                    /* report entire list? */
97 +                fputs(RFeatureList, stdout);
98 +
99 +        for ( ; ac-- > 0; av++) {       /* check each argument */
100 +                char    *cp;
101 +                if (!*av[0]) continue;
102 +                if ((cp = strchr(av[0], '=')) != NULL) {
103 +                        if (!match_subfeatures(get_feature(av[0]), cp+1))
104 +                                goto missing_feature;
105 +                } else if ((cp = get_feature(av[0])) != NULL) {
106 +                        char    *tp = strchr(cp, '=');
107 +                        if (tp && tp < strchr(cp, '\n'))
108 +                                do
109 +                                        fputc(*cp, stdout);
110 +                                while (*cp++ != '\n');
111 +                } else
112 +                        goto missing_feature;
113 +        }
114 +        return(0);                      /* return satisfactory status */
115 + missing_feature:                        /* or report error */
116 +        fprintf(stderr, "%s: missing feature - %s\n", progname, av[0]);
117 +        return(1);
118 + }
119 +
120 +
121 + int
122   getrenderopt(           /* get next render option */
123          int  ac,
124          char  *av[]
# Line 144 | Line 248 | getrenderopt(          /* get next render option */
248                                  amblp = amblist;
249                          }
250                          if (av[0][2] == 'I') {  /* file */
251 <                                rval = wordfile(amblp,
251 >                                rval = wordfile(amblp, AMBLLEN-(amblp-amblist),
252                                          getpath(av[1],getrlibpath(),R_OK));
253                                  if (rval < 0) {
254                                          sprintf(errmsg,
# Line 165 | Line 269 | getrenderopt(          /* get next render option */
269                                  amblp = amblist;
270                          }
271                          if (av[0][2] == 'E') {  /* file */
272 <                                rval = wordfile(amblp,
272 >                                rval = wordfile(amblp, AMBLLEN-(amblp-amblist),
273                                          getpath(av[1],getrlibpath(),R_OK));
274                                  if (rval < 0) {
275                                          sprintf(errmsg,
# Line 208 | Line 312 | getrenderopt(          /* get next render option */
312                          return(1);
313                  }
314                  break;
315 + #if MAXCSAMP>3
316 +        case 'c':                               /* spectral sampling */
317 +                switch (av[0][2]) {
318 +                case 's':                       /* spectral bin count */
319 +                        check(3,"i");
320 +                        NCSAMP = atoi(av[1]);
321 +                        return(1);
322 +                case 'w':                       /* wavelength extrema */
323 +                        check(3,"ff");
324 +                        WLPART[0] = atof(av[1]);
325 +                        WLPART[3] = atof(av[2]);
326 +                        return(2);
327 +                }
328 +                break;
329 + #endif
330          }
331          
332          /* PMAP: Parse photon mapping options */
# Line 255 | Line 374 | print_rdefaults(void)          /* print default render values
374                          colval(salbedo,GRN), colval(salbedo,BLU));
375          printf("-mg %f\t\t\t# mist scattering eccentricity\n", seccg);
376          printf("-ms %f\t\t\t# mist sampling distance\n", ssampdist);
377 +        if (NCSAMP > 3) {
378 +                printf("-cs %-2d\t\t\t\t# number of spectral bins\n", NCSAMP);
379 +                printf("-cw %3.0f %3.0f\t\t\t# wavelength limits (nm)\n",
380 +                                WLPART[3], WLPART[0]);
381 +        }
382          printf("-lr %-9d\t\t\t# limit reflection%s\n", maxdepth,
383                          maxdepth<=0 ? " (Russian roulette)" : "");
384          printf("-lw %.2e\t\t\t# limit weight\n", minweight);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines