ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapparm.c
Revision: 2.2
Committed: Fri May 8 13:20:23 2015 UTC (9 years, 11 months ago) by rschregle
Content type: text/plain
Branch: MAIN
Changes since 2.1: +3 -2 lines
Log Message:
Double-counting bugfix for glow sources (thanks DGM!), revised copyright

File Contents

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