ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapsrc.h
Revision: 2.3
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.2: +2 -1 lines
Log Message:
Added missing RCSid forgotten during initial check-in

File Contents

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