ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapsrc.h
Revision: 2.7
Committed: Fri Aug 7 01:21:13 2020 UTC (3 years, 9 months ago) by rschregle
Content type: text/plain
Branch: MAIN
CVS Tags: rad5R4, rad5R3, HEAD
Changes since 2.6: +16 -5 lines
Log Message:
feat(mkpmap): Extended -apo option to reorient photon ports.

File Contents

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