ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapparm.c
Revision: 2.9
Committed: Fri Feb 2 19:47:55 2018 UTC (6 years, 2 months ago) by rschregle
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, HEAD
Changes since 2.8: +6 -3 lines
Log Message:
Added -lr, -ld options to mkpmap, enabled -api

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: pmapparm.c,v 2.8 2017/08/14 21:12:10 rschregle Exp $";
3 #endif
4
5 /*
6 ======================================================================
7 Parameters for photon map generation and rendering; used by mkpmap
8 and rpict/rvu/rtrace.
9
10 Roland Schregle (roland.schregle@{hslu.ch, gmail.com}
11 (c) Fraunhofer Institute for Solar Energy Systems,
12 (c) Lucerne University of Applied Sciences and Arts,
13 supported by the Swiss National Science Foundation (SNSF, #147053)
14 ======================================================================
15
16 $Id: pmapparm.c,v 2.8 2017/08/14 21:12:10 rschregle Exp $
17 */
18
19
20 #include "pmapparm.h"
21 #include "pmapdata.h"
22 #include <ctype.h>
23
24
25 float pdfSamples = 1000, /* PDF samples per steradian */
26
27 finalGather = 0.25, /* fraction of global photons for
28 irradiance precomputation */
29
30 preDistrib = 0.25, /* fraction of num photons for
31 distribution prepass */
32
33 gatherTolerance = 0.5, /* Photon map lookup tolerance;
34 lookups returning fewer than this
35 fraction of minGather/maxGather
36 are restarted with a larger
37 search radius */
38
39 maxDistFix = 0, /* Static maximum photon search
40 radius (radius is adaptive if
41 this is zero) */
42
43 photonMaxDist = 0; /* Maximum cumulative distance of
44 photon path */
45
46 #ifdef PMAP_OOC
47 float pmapCachePageSize = 8; /* OOC cache pagesize as multiple
48 * of maxGather */
49 unsigned long pmapCacheSize = 1e6; /* OOC cache size in photons */
50 #endif
51
52
53 /* Regions of interest */
54 unsigned pmapNumROI = 0;
55 PhotonMapROI *pmapROI = NULL;
56
57
58 unsigned verbose = 0; /* Verbose console output */
59 unsigned long photonMaxBounce = 5000; /* Runaway photon bounce limit */
60 unsigned photonRepTime = 0, /* Seconds between reports */
61 maxPreDistrib = 4, /* Max predistrib passes */
62 defaultGather = 40; /* Default num photons for lookup */
63
64
65 /* Per photon map params */
66 PhotonMapParams pmapParams [NUM_PMAP_TYPES] = {
67 {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0}, {NULL, 0, 0, 0},
68 {NULL, 0, 0, 0}, {NULL, 0, 0, 0}
69 };
70
71
72 int setPmapParam (PhotonMap** pm, const PhotonMapParams* parm)
73 {
74 if (parm && parm -> fileName) {
75 if (!(*pm = (PhotonMap*)malloc(sizeof(PhotonMap))))
76 error(INTERNAL, "failed to allocate photon map");
77
78 (*pm) -> fileName = parm -> fileName;
79 (*pm) -> minGather = parm -> minGather;
80 (*pm) -> maxGather = parm -> maxGather;
81 (*pm) -> distribTarget = parm -> distribTarget;
82 (*pm) -> maxDist0 = FHUGE;
83 (*pm) -> srcContrib = NULL;
84
85 return 1;
86 }
87
88 return 0;
89 }
90
91
92 unsigned long parseMultiplier (const char *num)
93 {
94 unsigned long mult = 1;
95 const int strEnd = strlen(num) - 1;
96
97 if (strEnd <= 0)
98 return 0;
99
100 if (!isdigit(num [strEnd]))
101 switch (toupper(num [strEnd])) {
102 case 'G': mult *= 1000;
103 case 'M': mult *= 1000;
104 case 'K': mult *= 1000;
105 break;
106 default : error(USER, "unknown multiplier");
107 }
108
109 return (unsigned long)(mult * atof(num));
110 }