ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapparm.c
Revision: 2.5
Committed: Tue Aug 18 18:45:55 2015 UTC (8 years, 9 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.4: +4 -1 lines
Log Message:
Added missing RCSid forgotten during initial check-in

File Contents

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