-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathprojection_8cpp-source.html
160 lines (160 loc) · 28.1 KB
/
projection_8cpp-source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>pbrt: projection.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>projection.cpp</h1><a href="projection_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00002"></a>00002 <span class="comment">/*</span>
<a name="l00003"></a>00003 <span class="comment"> pbrt source code Copyright(c) 1998-2007 Matt Pharr and Greg Humphreys.</span>
<a name="l00004"></a>00004 <span class="comment"></span>
<a name="l00005"></a>00005 <span class="comment"> This file is part of pbrt.</span>
<a name="l00006"></a>00006 <span class="comment"></span>
<a name="l00007"></a>00007 <span class="comment"> pbrt is free software; you can redistribute it and/or modify</span>
<a name="l00008"></a>00008 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
<a name="l00009"></a>00009 <span class="comment"> the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00010"></a>00010 <span class="comment"> (at your option) any later version. Note that the text contents of</span>
<a name="l00011"></a>00011 <span class="comment"> the book "Physically Based Rendering" are *not* licensed under the</span>
<a name="l00012"></a>00012 <span class="comment"> GNU GPL.</span>
<a name="l00013"></a>00013 <span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment"> pbrt is distributed in the hope that it will be useful,</span>
<a name="l00015"></a>00015 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00016"></a>00016 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00017"></a>00017 <span class="comment"> GNU General Public License for more details.</span>
<a name="l00018"></a>00018 <span class="comment"></span>
<a name="l00019"></a>00019 <span class="comment"> You should have received a copy of the GNU General Public License</span>
<a name="l00020"></a>00020 <span class="comment"> along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
<a name="l00021"></a>00021 <span class="comment"></span>
<a name="l00022"></a>00022 <span class="comment"> */</span>
<a name="l00023"></a>00023
<a name="l00024"></a>00024 <span class="comment">// projection.cpp*</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="pbrt_8h.html">pbrt.h</a>"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="light_8h.html">light.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="shape_8h.html">shape.h</a>"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="mipmap_8h.html">mipmap.h</a>"</span>
<a name="l00029"></a>00029 <span class="comment">// ProjectionLight Declarations</span>
<a name="l00030"></a><a class="code" href="classProjectionLight.html">00030</a> <span class="keyword">class </span><a class="code" href="classProjectionLight.html">ProjectionLight</a> : <span class="keyword">public</span> <a class="code" href="classLight.html">Light</a> {
<a name="l00031"></a>00031 <span class="keyword">public</span>:
<a name="l00032"></a>00032 <span class="comment">// ProjectionLight Public Methods</span>
<a name="l00033"></a>00033 <a class="code" href="classProjectionLight.html#7ef2277d824289282196d6ad6e231859">ProjectionLight</a>(<span class="keyword">const</span> <a class="code" href="classTransform.html">Transform</a> &light2world, <span class="keyword">const</span> <a class="code" href="classSpectrum.html">Spectrum</a> &intensity,
<a name="l00034"></a>00034 <span class="keyword">const</span> <span class="keywordtype">string</span> &texname, <span class="keywordtype">float</span> fov);
<a name="l00035"></a>00035 <a class="code" href="classProjectionLight.html#a786ca22c35143fde0e07f833cc1918c">~ProjectionLight</a>();
<a name="l00036"></a>00036 <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#0f3f4b3e47464c007852b4c99b114e23">Sample_L</a>(<span class="keyword">const</span> <a class="code" href="classPoint.html">Point</a> &p, <a class="code" href="classVector.html">Vector</a> *wi, <a class="code" href="structVisibilityTester.html">VisibilityTester</a> *vis) <span class="keyword">const</span>;
<a name="l00037"></a><a class="code" href="classProjectionLight.html#632efd384cd85dc9cee7fe3864d2e3b4">00037</a> <span class="keywordtype">bool</span> <a class="code" href="classProjectionLight.html#632efd384cd85dc9cee7fe3864d2e3b4">IsDeltaLight</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">true</span>; }
<a name="l00038"></a>00038 <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#2cfd7c4d101ad12aac8b35c5af488ed0">Projection</a>(<span class="keyword">const</span> <a class="code" href="classVector.html">Vector</a> &w) <span class="keyword">const</span>;
<a name="l00039"></a><a class="code" href="classProjectionLight.html#dac5511565390d4a2c606f5d325c85fb">00039</a> <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#dac5511565390d4a2c606f5d325c85fb">Power</a>(<span class="keyword">const</span> <a class="code" href="classScene.html">Scene</a> *)<span class="keyword"> const </span>{
<a name="l00040"></a>00040 <span class="keywordflow">return</span> <a class="code" href="classProjectionLight.html#206e38ea3efebd9ad3ff20bdb5d9dbb2">Intensity</a> * 2.f * <a class="code" href="pbrt_8h.html#e71449b1cc6e6250b91f539153a7a0d3">M_PI</a> * (1.f - <a class="code" href="classProjectionLight.html#7564ee94caf4e784b4d43defd8863bdf">cosTotalWidth</a>) *
<a name="l00041"></a>00041 <a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">projectionMap</a>-><a class="code" href="classMIPMap.html#401e4e6d7bd87aae7df1ed7f87a67ed5">Lookup</a>(.5f, .5f, .5f);
<a name="l00042"></a>00042 }
<a name="l00043"></a>00043 <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#0f3f4b3e47464c007852b4c99b114e23">Sample_L</a>(<span class="keyword">const</span> <a class="code" href="classPoint.html">Point</a> &P, <span class="keywordtype">float</span> u1, <span class="keywordtype">float</span> u2, <a class="code" href="classVector.html">Vector</a> *wo,
<a name="l00044"></a>00044 <span class="keywordtype">float</span> *pdf, <a class="code" href="structVisibilityTester.html">VisibilityTester</a> *visibility) <span class="keyword">const</span>;
<a name="l00045"></a>00045 <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#0f3f4b3e47464c007852b4c99b114e23">Sample_L</a>(<span class="keyword">const</span> <a class="code" href="classScene.html">Scene</a> *scene, <span class="keywordtype">float</span> u1, <span class="keywordtype">float</span> u2,
<a name="l00046"></a>00046 <span class="keywordtype">float</span> u3, <span class="keywordtype">float</span> u4, <a class="code" href="classRay.html">Ray</a> *ray, <span class="keywordtype">float</span> *pdf) <span class="keyword">const</span>;
<a name="l00047"></a>00047 <span class="keywordtype">float</span> <a class="code" href="classProjectionLight.html#0325d69f0cb5cc02d55d9625a01f6cfc">Pdf</a>(<span class="keyword">const</span> <a class="code" href="classPoint.html">Point</a> &, <span class="keyword">const</span> <a class="code" href="classVector.html">Vector</a> &) <span class="keyword">const</span>;
<a name="l00048"></a>00048 <span class="keyword">private</span>:
<a name="l00049"></a>00049 <span class="comment">// ProjectionLight Private Data</span>
<a name="l00050"></a><a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">00050</a> <a class="code" href="classMIPMap.html">MIPMap<Spectrum></a> *<a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">projectionMap</a>;
<a name="l00051"></a><a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">00051</a> <a class="code" href="classPoint.html">Point</a> <a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a>;
<a name="l00052"></a><a class="code" href="classProjectionLight.html#206e38ea3efebd9ad3ff20bdb5d9dbb2">00052</a> <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#206e38ea3efebd9ad3ff20bdb5d9dbb2">Intensity</a>;
<a name="l00053"></a><a class="code" href="classProjectionLight.html#e6dc1c4a57895ae7dcb7acc21d2316f4">00053</a> <a class="code" href="classTransform.html">Transform</a> <a class="code" href="classProjectionLight.html#e6dc1c4a57895ae7dcb7acc21d2316f4">lightProjection</a>;
<a name="l00054"></a><a class="code" href="classProjectionLight.html#7d3a14a290fca13c8048c6d767802f44">00054</a> <span class="keywordtype">float</span> <a class="code" href="classProjectionLight.html#7c3e4a789c59532867163cf7fce17b35">hither</a>, <a class="code" href="classProjectionLight.html#7d3a14a290fca13c8048c6d767802f44">yon</a>;
<a name="l00055"></a><a class="code" href="classProjectionLight.html#e89f6babe04385b9c3c377c024d876da">00055</a> <span class="keywordtype">float</span> <a class="code" href="classProjectionLight.html#0cff01a9334b29279571aff5ae37d8c1">screenX0</a>, <a class="code" href="classProjectionLight.html#2ea31b0c7bce3d8f842fdd05d209ba2c">screenX1</a>, <a class="code" href="classProjectionLight.html#2752be44fecdba36384699314158c3b4">screenY0</a>, <a class="code" href="classProjectionLight.html#e89f6babe04385b9c3c377c024d876da">screenY1</a>;
<a name="l00056"></a><a class="code" href="classProjectionLight.html#7564ee94caf4e784b4d43defd8863bdf">00056</a> <span class="keywordtype">float</span> <a class="code" href="classProjectionLight.html#7564ee94caf4e784b4d43defd8863bdf">cosTotalWidth</a>;
<a name="l00057"></a>00057 };
<a name="l00058"></a>00058 <span class="comment">// ProjectionLight Method Definitions</span>
<a name="l00059"></a>00059 <a class="code" href="classProjectionLight.html#7ef2277d824289282196d6ad6e231859">ProjectionLight::</a>
<a name="l00060"></a><a class="code" href="classProjectionLight.html#7ef2277d824289282196d6ad6e231859">00060</a> <a class="code" href="classProjectionLight.html#7ef2277d824289282196d6ad6e231859"> ProjectionLight</a>(<span class="keyword">const</span> <a class="code" href="classTransform.html">Transform</a> &light2world,
<a name="l00061"></a>00061 <span class="keyword">const</span> <a class="code" href="classSpectrum.html">Spectrum</a> &intensity, <span class="keyword">const</span> <span class="keywordtype">string</span> &texname,
<a name="l00062"></a>00062 <span class="keywordtype">float</span> fov)
<a name="l00063"></a>00063 : <a class="code" href="classLight.html">Light</a>(light2world) {
<a name="l00064"></a>00064 <a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a> = <a class="code" href="classLight.html#e405f6543d4d8ee5573183b4ca2c587e">LightToWorld</a>(<a class="code" href="classPoint.html">Point</a>(0,0,0));
<a name="l00065"></a>00065 <a class="code" href="classProjectionLight.html#206e38ea3efebd9ad3ff20bdb5d9dbb2">Intensity</a> = intensity;
<a name="l00066"></a>00066 <span class="comment">// Create _ProjectionLight_ MIP-map</span>
<a name="l00067"></a>00067 <span class="keywordtype">int</span> width, height;
<a name="l00068"></a>00068 <a class="code" href="classSpectrum.html">Spectrum</a> *texels = <a class="code" href="exrio_8cpp.html#95815745d79c6bcbc71d3373c36f3c9e">ReadImage</a>(texname, &width, &height);
<a name="l00069"></a>00069 <span class="keywordflow">if</span> (texels)
<a name="l00070"></a>00070 <a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">projectionMap</a> =
<a name="l00071"></a>00071 <span class="keyword">new</span> <a class="code" href="classMIPMap.html">MIPMap<Spectrum></a>(width, height, texels);
<a name="l00072"></a>00072 <span class="keywordflow">else</span>
<a name="l00073"></a>00073 <a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">projectionMap</a> = NULL;
<a name="l00074"></a>00074 <span class="keyword">delete</span>[] texels;
<a name="l00075"></a>00075 <span class="comment">// Initialize _ProjectionLight_ projection matrix</span>
<a name="l00076"></a>00076 <span class="keywordtype">float</span> aspect = float(width) / float(height);
<a name="l00077"></a>00077 <span class="keywordflow">if</span> (aspect > 1.f) {
<a name="l00078"></a>00078 <a class="code" href="classProjectionLight.html#0cff01a9334b29279571aff5ae37d8c1">screenX0</a> = -aspect; <a class="code" href="classProjectionLight.html#2ea31b0c7bce3d8f842fdd05d209ba2c">screenX1</a> = aspect;
<a name="l00079"></a>00079 <a class="code" href="classProjectionLight.html#2752be44fecdba36384699314158c3b4">screenY0</a> = -1.f; <a class="code" href="classProjectionLight.html#e89f6babe04385b9c3c377c024d876da">screenY1</a> = 1.f;
<a name="l00080"></a>00080 }
<a name="l00081"></a>00081 <span class="keywordflow">else</span> {
<a name="l00082"></a>00082 <a class="code" href="classProjectionLight.html#0cff01a9334b29279571aff5ae37d8c1">screenX0</a> = -1.f; <a class="code" href="classProjectionLight.html#2ea31b0c7bce3d8f842fdd05d209ba2c">screenX1</a> = 1.f;
<a name="l00083"></a>00083 <a class="code" href="classProjectionLight.html#2752be44fecdba36384699314158c3b4">screenY0</a> = -1.f / aspect; <a class="code" href="classProjectionLight.html#e89f6babe04385b9c3c377c024d876da">screenY1</a> = 1.f / aspect;
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 <a class="code" href="classProjectionLight.html#7c3e4a789c59532867163cf7fce17b35">hither</a> = <a class="code" href="pbrt_8h.html#7507e14449e57d80d946ee4509de1b3b">RAY_EPSILON</a>;
<a name="l00086"></a>00086 <a class="code" href="classProjectionLight.html#7d3a14a290fca13c8048c6d767802f44">yon</a> = 1e30f;
<a name="l00087"></a>00087 <a class="code" href="classProjectionLight.html#e6dc1c4a57895ae7dcb7acc21d2316f4">lightProjection</a> = <a class="code" href="pbrt_8h.html#b6306bd808488c136237a0dfe1cb57e5">Perspective</a>(fov, <a class="code" href="classProjectionLight.html#7c3e4a789c59532867163cf7fce17b35">hither</a>, <a class="code" href="classProjectionLight.html#7d3a14a290fca13c8048c6d767802f44">yon</a>);
<a name="l00088"></a>00088 <span class="comment">// Compute cosine of cone surrounding projection directions</span>
<a name="l00089"></a>00089 <span class="keywordtype">float</span> opposite = tanf(<a class="code" href="pbrt_8h.html#12544670622d3fbc783e1cb4d56b3a23">Radians</a>(fov) / 2.f);
<a name="l00090"></a>00090 <span class="keywordtype">float</span> tanDiag = opposite * sqrtf(1.f + 1.f/(aspect*aspect));
<a name="l00091"></a>00091 <a class="code" href="classProjectionLight.html#7564ee94caf4e784b4d43defd8863bdf">cosTotalWidth</a> = cosf(atanf(tanDiag));
<a name="l00092"></a>00092 }
<a name="l00093"></a><a class="code" href="classProjectionLight.html#a786ca22c35143fde0e07f833cc1918c">00093</a> <a class="code" href="classProjectionLight.html#a786ca22c35143fde0e07f833cc1918c">ProjectionLight::~ProjectionLight</a>() { <span class="keyword">delete</span> <a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">projectionMap</a>; }
<a name="l00094"></a><a class="code" href="classProjectionLight.html#0f3f4b3e47464c007852b4c99b114e23">00094</a> <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#0f3f4b3e47464c007852b4c99b114e23">ProjectionLight::Sample_L</a>(<span class="keyword">const</span> <a class="code" href="classPoint.html">Point</a> &p, <a class="code" href="classVector.html">Vector</a> *wi,
<a name="l00095"></a>00095 <a class="code" href="structVisibilityTester.html">VisibilityTester</a> *visibility)<span class="keyword"> const </span>{
<a name="l00096"></a>00096 *wi = <a class="code" href="geometry_8h.html#46448bfa3df1c2de5e3b763f163866a4">Normalize</a>(<a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a> - p);
<a name="l00097"></a>00097 visibility-><a class="code" href="structVisibilityTester.html#5576bb7bf15006fb3f834bd817fa26a0">SetSegment</a>(p, <a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a>);
<a name="l00098"></a>00098 <span class="keywordflow">return</span> <a class="code" href="classProjectionLight.html#206e38ea3efebd9ad3ff20bdb5d9dbb2">Intensity</a> * <a class="code" href="classProjectionLight.html#2cfd7c4d101ad12aac8b35c5af488ed0">Projection</a>(-*wi) /
<a name="l00099"></a>00099 <a class="code" href="geometry_8h.html#7e7a8e6ca4a481e5f0d1c44312a956d0">DistanceSquared</a>(<a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a>, p);
<a name="l00100"></a>00100 }
<a name="l00101"></a><a class="code" href="classProjectionLight.html#2cfd7c4d101ad12aac8b35c5af488ed0">00101</a> <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#2cfd7c4d101ad12aac8b35c5af488ed0">ProjectionLight::Projection</a>(<span class="keyword">const</span> <a class="code" href="classVector.html">Vector</a> &w)<span class="keyword"> const </span>{
<a name="l00102"></a>00102 <a class="code" href="classVector.html">Vector</a> wl = <a class="code" href="classLight.html#1b7aa72842da321f891fd8661ed19955">WorldToLight</a>(w);
<a name="l00103"></a>00103 <span class="comment">// Discard directions behind projection light</span>
<a name="l00104"></a>00104 <span class="keywordflow">if</span> (wl.<a class="code" href="classVector.html#0e84237d0830d5c459bfa5676b5fbfba">z</a> < <a class="code" href="classProjectionLight.html#7c3e4a789c59532867163cf7fce17b35">hither</a>) <span class="keywordflow">return</span> 0.;
<a name="l00105"></a>00105 <span class="comment">// Project point on to projection plane and compute light</span>
<a name="l00106"></a>00106 <a class="code" href="classPoint.html">Point</a> Pl = <a class="code" href="classProjectionLight.html#e6dc1c4a57895ae7dcb7acc21d2316f4">lightProjection</a>(<a class="code" href="classPoint.html">Point</a>(wl.<a class="code" href="classVector.html#ca49165049a1e21ae47afcfc078819ed">x</a>, wl.<a class="code" href="classVector.html#81be9102fca6d9beea3efef522c4c09d">y</a>, wl.<a class="code" href="classVector.html#0e84237d0830d5c459bfa5676b5fbfba">z</a>));
<a name="l00107"></a>00107 <span class="keywordflow">if</span> (Pl.<a class="code" href="classPoint.html#05dfe2dfbde813ad234b514f30e662f1">x</a> < <a class="code" href="classProjectionLight.html#0cff01a9334b29279571aff5ae37d8c1">screenX0</a> || Pl.<a class="code" href="classPoint.html#05dfe2dfbde813ad234b514f30e662f1">x</a> > <a class="code" href="classProjectionLight.html#2ea31b0c7bce3d8f842fdd05d209ba2c">screenX1</a> ||
<a name="l00108"></a>00108 Pl.<a class="code" href="classPoint.html#6101960c8d2d4e8ea1d32c9234bbeb8d">y</a> < <a class="code" href="classProjectionLight.html#2752be44fecdba36384699314158c3b4">screenY0</a> || Pl.<a class="code" href="classPoint.html#6101960c8d2d4e8ea1d32c9234bbeb8d">y</a> > <a class="code" href="classProjectionLight.html#e89f6babe04385b9c3c377c024d876da">screenY1</a>) <span class="keywordflow">return</span> 0.;
<a name="l00109"></a>00109 <span class="keywordflow">if</span> (!<a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">projectionMap</a>) <span class="keywordflow">return</span> 1;
<a name="l00110"></a>00110 <span class="keywordtype">float</span> s = (Pl.<a class="code" href="classPoint.html#05dfe2dfbde813ad234b514f30e662f1">x</a> - <a class="code" href="classProjectionLight.html#0cff01a9334b29279571aff5ae37d8c1">screenX0</a>) / (<a class="code" href="classProjectionLight.html#2ea31b0c7bce3d8f842fdd05d209ba2c">screenX1</a> - <a class="code" href="classProjectionLight.html#0cff01a9334b29279571aff5ae37d8c1">screenX0</a>);
<a name="l00111"></a>00111 <span class="keywordtype">float</span> t = (Pl.<a class="code" href="classPoint.html#6101960c8d2d4e8ea1d32c9234bbeb8d">y</a> - <a class="code" href="classProjectionLight.html#2752be44fecdba36384699314158c3b4">screenY0</a>) / (<a class="code" href="classProjectionLight.html#e89f6babe04385b9c3c377c024d876da">screenY1</a> - <a class="code" href="classProjectionLight.html#2752be44fecdba36384699314158c3b4">screenY0</a>);
<a name="l00112"></a>00112 <span class="keywordflow">return</span> <a class="code" href="classProjectionLight.html#3d8cca5baa5f142cd32d8be7fc4a1019">projectionMap</a>-><a class="code" href="classMIPMap.html#401e4e6d7bd87aae7df1ed7f87a67ed5">Lookup</a>(s, t);
<a name="l00113"></a>00113 }
<a name="l00114"></a><a class="code" href="classProjectionLight.html#a0406a42b449995f6318a9252821cf88">00114</a> <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#0f3f4b3e47464c007852b4c99b114e23">ProjectionLight::Sample_L</a>(<span class="keyword">const</span> <a class="code" href="classPoint.html">Point</a> &p, <span class="keywordtype">float</span> u1, <span class="keywordtype">float</span> u2,
<a name="l00115"></a>00115 <a class="code" href="classVector.html">Vector</a> *wi, <span class="keywordtype">float</span> *pdf,
<a name="l00116"></a>00116 <a class="code" href="structVisibilityTester.html">VisibilityTester</a> *visibility)<span class="keyword"> const </span>{
<a name="l00117"></a>00117 *wi = <a class="code" href="geometry_8h.html#46448bfa3df1c2de5e3b763f163866a4">Normalize</a>(<a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a> - p);
<a name="l00118"></a>00118 *pdf = 1.f;
<a name="l00119"></a>00119 visibility-><a class="code" href="structVisibilityTester.html#5576bb7bf15006fb3f834bd817fa26a0">SetSegment</a>(p, <a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a>);
<a name="l00120"></a>00120 <span class="keywordflow">return</span> <a class="code" href="classProjectionLight.html#206e38ea3efebd9ad3ff20bdb5d9dbb2">Intensity</a> * <a class="code" href="classProjectionLight.html#2cfd7c4d101ad12aac8b35c5af488ed0">Projection</a>(-*wi) / <a class="code" href="geometry_8h.html#7e7a8e6ca4a481e5f0d1c44312a956d0">DistanceSquared</a>(<a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a>, p);
<a name="l00121"></a>00121 }
<a name="l00122"></a><a class="code" href="classProjectionLight.html#2fd39033a1a6378514ebe3c2eee3847e">00122</a> <a class="code" href="classSpectrum.html">Spectrum</a> <a class="code" href="classProjectionLight.html#0f3f4b3e47464c007852b4c99b114e23">ProjectionLight::Sample_L</a>(<span class="keyword">const</span> <a class="code" href="classScene.html">Scene</a> *scene, <span class="keywordtype">float</span> u1, <span class="keywordtype">float</span> u2,
<a name="l00123"></a>00123 <span class="keywordtype">float</span> u3, <span class="keywordtype">float</span> u4, <a class="code" href="classRay.html">Ray</a> *ray, <span class="keywordtype">float</span> *pdf)<span class="keyword"> const </span>{
<a name="l00124"></a>00124 ray-><a class="code" href="classRay.html#1014d000992e8ac3b92f150ad2a5cffe">o</a> = <a class="code" href="classProjectionLight.html#81a9641c4042ff1b50218a0e1f126d56">lightPos</a>;
<a name="l00125"></a>00125 <a class="code" href="classVector.html">Vector</a> v = <a class="code" href="mc_8cpp.html#93069aab77f7afe6d400aad138a88589">UniformSampleCone</a>(u1, u2, <a class="code" href="classProjectionLight.html#7564ee94caf4e784b4d43defd8863bdf">cosTotalWidth</a>);
<a name="l00126"></a>00126 ray-><a class="code" href="classRay.html#5bbfc94e178e0a050b51200acc579069">d</a> = <a class="code" href="classLight.html#e405f6543d4d8ee5573183b4ca2c587e">LightToWorld</a>(v);
<a name="l00127"></a>00127 *pdf = <a class="code" href="mc_8cpp.html#89f67dd9be5e02039378d9788044690c">UniformConePdf</a>(<a class="code" href="classProjectionLight.html#7564ee94caf4e784b4d43defd8863bdf">cosTotalWidth</a>);
<a name="l00128"></a>00128 <span class="keywordflow">return</span> <a class="code" href="classProjectionLight.html#206e38ea3efebd9ad3ff20bdb5d9dbb2">Intensity</a> * <a class="code" href="classProjectionLight.html#2cfd7c4d101ad12aac8b35c5af488ed0">Projection</a>(ray-><a class="code" href="classRay.html#5bbfc94e178e0a050b51200acc579069">d</a>);
<a name="l00129"></a>00129 }
<a name="l00130"></a><a class="code" href="classProjectionLight.html#0325d69f0cb5cc02d55d9625a01f6cfc">00130</a> <span class="keywordtype">float</span> <a class="code" href="classProjectionLight.html#0325d69f0cb5cc02d55d9625a01f6cfc">ProjectionLight::Pdf</a>(<span class="keyword">const</span> <a class="code" href="classPoint.html">Point</a> &, <span class="keyword">const</span> <a class="code" href="classVector.html">Vector</a> &)<span class="keyword"> const </span>{
<a name="l00131"></a>00131 <span class="keywordflow">return</span> 0.;
<a name="l00132"></a>00132 }
<a name="l00133"></a><a class="code" href="projection_8cpp.html#490f507d1e9d24b745170dc3cff2fad2">00133</a> <span class="keyword">extern</span> <span class="stringliteral">"C"</span> <a class="code" href="pbrt_8h.html#808e08638be3cba36e36759e5b150de0">DLLEXPORT</a> <a class="code" href="classLight.html">Light</a> *<a class="code" href="distant_8cpp.html#490f507d1e9d24b745170dc3cff2fad2">CreateLight</a>(<span class="keyword">const</span> <a class="code" href="classTransform.html">Transform</a> &light2world,
<a name="l00134"></a>00134 <span class="keyword">const</span> <a class="code" href="classParamSet.html">ParamSet</a> &paramSet) {
<a name="l00135"></a>00135 <a class="code" href="classSpectrum.html">Spectrum</a> I = paramSet.<a class="code" href="classParamSet.html#abe7a9db3a1aff8d7ec06408c34adc14">FindOneSpectrum</a>(<span class="stringliteral">"I"</span>, <a class="code" href="classSpectrum.html">Spectrum</a>(1.0));
<a name="l00136"></a>00136 <span class="keywordtype">float</span> fov = paramSet.<a class="code" href="classParamSet.html#87143fd8e73a75082179a110d42531a4">FindOneFloat</a>(<span class="stringliteral">"fov"</span>, 45.);
<a name="l00137"></a>00137 <span class="keywordtype">string</span> texname = paramSet.<a class="code" href="classParamSet.html#a3f26c4aa7282d1a548bc14cc4409598">FindOneString</a>(<span class="stringliteral">"mapname"</span>, <span class="stringliteral">""</span>);
<a name="l00138"></a>00138 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classProjectionLight.html#7ef2277d824289282196d6ad6e231859">ProjectionLight</a>(light2world, I, texname, fov);
<a name="l00139"></a>00139 }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 20 17:31:53 2009 for pbrt by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>