ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapparm.c
Revision: 2.6
Committed: Tue Sep 1 16:27:52 2015 UTC (9 years, 8 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R0
Changes since 2.5: +1 -2 lines
Log Message:
Removed redundant $Id: in file

File Contents

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