ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapopt.c
Revision: 2.5
Committed: Tue May 26 13:31:19 2015 UTC (8 years, 11 months ago) by rschregle
Content type: text/plain
Branch: MAIN
Changes since 2.4: +4 -4 lines
Log Message:
-am option to rpict/rvu/rtrace now sets fixed max photon search radius,
-overriding the adaptive max search radius

File Contents

# User Rev Content
1 greg 2.1 /*
2     ==================================================================
3     Photon map interface to RADIANCE render options
4    
5     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
6     (c) Fraunhofer Institute for Solar Energy Systems,
7 rschregle 2.2 (c) Lucerne University of Applied Sciences and Arts,
8     supported by the Swiss National Science Foundation (SNSF, #147053)
9 greg 2.1 ==================================================================
10    
11 rschregle 2.5 $Id: pmapopt.c,v 2.4 2015/05/22 14:12:11 greg Exp $
12 greg 2.1 */
13    
14    
15    
16 greg 2.3 #include "ray.h"
17 greg 2.1 #include "pmapparm.h"
18    
19    
20    
21     int getPmapRenderOpt (int ac, char *av [])
22     /* Parse next render option for photon map; interface to getrenderopt();
23     * return -1 if parsing failed, else number of parameters consumed */
24     {
25     #define check(ol,al) (av[0][ol] || badarg(ac-1,av+1,al))
26    
27     static int t = -1; /* pmap parameter index */
28    
29     if (ac < 1 || !av [0] || av [0][0] != '-')
30     return -1;
31    
32     switch (av [0][1]) {
33     case 'a':
34     switch (av [0][2]) {
35     case 'p': /* photon map */
36 greg 2.3 /* Asking for photon map, ergo ambounce != 0 */
37     ambounce += (ambounce == 0);
38 greg 2.1 if (!check(3, "s")) {
39     /* File -> assume bwidth = 1 or precomputed pmap */
40     if (++t >= NUM_PMAP_TYPES)
41     error(USER, "too many photon maps");
42    
43     pmapParams [t].fileName = savqstr(av [1]);
44     pmapParams [t].minGather = pmapParams [t].maxGather =
45     defaultGather;
46     }
47     else return -1;
48    
49     if (!check(3, "si")) {
50     /* File + bandwidth */
51     pmapParams [t].minGather = pmapParams [t].maxGather =
52     atoi(av [2]);
53    
54     if (!pmapParams [t].minGather)
55     return -1;
56     }
57     else {
58     sprintf(errmsg, "no photon lookup bandwidth specified, "
59     "using default %d", defaultGather);
60     error(WARNING, errmsg);
61     return 1;
62     }
63    
64     if (!check(3, "sii")) {
65     /* File + min bwidth + max bwidth -> bias compensation */
66     pmapParams [t].maxGather = atoi(av [3]);
67    
68     if (pmapParams [t].minGather >= pmapParams [t].maxGather)
69     return -1;
70    
71     return 3;
72     }
73     else return 2;
74    
75 rschregle 2.5 case 'm': /* Fixed max photon search radius */
76     if (check(3, "f") || (maxDistFix = atof(av [1])) <= 0)
77 greg 2.1 error(USER, "invalid max photon search radius coefficient");
78    
79     return 1;
80     }
81     }
82     #undef check
83    
84     /* Unknown option */
85     return -1;
86     }
87    
88    
89    
90     void printPmapDefaults ()
91     /* Print defaults for photon map render options */
92     {
93 rschregle 2.5 printf("-am %.1f\t\t\t\t# max photon search radius\n", maxDistFix);
94 greg 2.1 }