ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapsrc.h
Revision: 2.6
Committed: Tue Mar 20 19:55:33 2018 UTC (6 years, 2 months ago) by rschregle
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R2
Changes since 2.5: +6 -5 lines
Log Message:
Added -ae/-ai ambient exclude options to mkpmap, cleaned up opt parsing.

File Contents

# User Rev Content
1 rschregle 2.6 /* RCSid $Id: pmapsrc.h,v 2.5 2016/05/17 17:39:47 rschregle Exp $ */
2 rschregle 2.5
3 greg 2.1 /*
4     ==================================================================
5     Photon map support routines for emission from light sources
6    
7     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
8     (c) Fraunhofer Institute for Solar Energy Systems,
9 rschregle 2.2 (c) Lucerne University of Applied Sciences and Arts,
10     supported by the Swiss National Science Foundation (SNSF, #147053)
11 greg 2.1 ==================================================================
12    
13 rschregle 2.6 $Id: pmapsrc.h,v 2.5 2016/05/17 17:39:47 rschregle Exp $
14 greg 2.1 */
15    
16    
17    
18     #ifndef PMAPSRC_H
19     #define PMAPSRC_H
20    
21     #include "ray.h"
22     #include "source.h"
23    
24    
25    
26     /* Data structures for photon emission */
27     typedef struct {
28     unsigned theta, phi; /* Direction indices */
29     COLOR pdf; /* Probability of emission in this
30     direction per RGB */
31     float cdf; /* Cumulative probability up to
32     this sample */
33     } EmissionSample;
34    
35     typedef struct {
36     unsigned numTheta, numPhi; /* Num divisions in theta & phi */
37     RREAL cosThetaMax; /* cos(source aperture) */
38     FVECT uh, vh, wh; /* Emission aperture axes at origin,
39     w is normal*/
40     FVECT us, vs, ws; /* Source surface axes at origin,
41     w is normal */
42     FVECT photonOrg; /* Current photon origin */
43     EmissionSample *samples; /* PDF samples for photon emission
44     directions */
45     unsigned long numPartitions; /* Number of surface partitions */
46     RREAL partArea; /* Area covered by each partition */
47     SRCREC *src, *port; /* Current source and port */
48     unsigned long partitionCnt, /* Current surface partition */
49     maxPartitions, /* Max allocated partitions */
50     numSamples; /* Number of PDF samples */
51     unsigned char* partitions; /* Source surface partitions */
52     COLOR partFlux; /* Total flux emitted by partition */
53     float cdf; /* Cumulative probability */
54     } EmissionMap;
55    
56    
57    
58 rschregle 2.6 /* Photon ports for emission from geometry en lieu of light sources */
59     extern char *photonPortList [MAXSET + 1];
60 greg 2.1 extern SRCREC *photonPorts;
61     extern unsigned numPhotonPorts;
62    
63     /* Dispatch tables for partitioning light source surfaces and generating
64     an origin for photon emission */
65     extern void (*photonPartition []) (EmissionMap*);
66     extern void (*photonOrigin []) (EmissionMap*);
67    
68    
69    
70 rschregle 2.6 void getPhotonPorts (char **portList);
71     /* Find geometry declared as photon ports from modifiers in portList */
72 greg 2.1
73     void initPhotonEmissionFuncs ();
74     /* Init photonPartition[] and photonOrigin[] dispatch tables with source
75     specific emission routines */
76    
77     void initPhotonEmission (EmissionMap *emap, float numPdfSamples);
78     /* Initialize photon emission from partitioned light source emap -> src;
79     * this involves integrating the flux emitted from the current photon
80     * origin emap -> photonOrg and setting up a PDF to sample the emission
81     * distribution with numPdfSamples samples */
82    
83     void emitPhoton (const EmissionMap*, RAY* ray);
84     /* Emit photon from current source partition based on emission
85     distribution and return new photon ray */
86    
87     void multDirectPmap (RAY *r);
88     /* Factor irradiance from direct photons into r -> rcol; interface to
89     * direct() */
90    
91     void inscatterVolumePmap (RAY *r, COLOR inscatter);
92     /* Add inscattering from volume photon map; interface to srcscatter() */
93    
94     #endif