-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathcheckerboard_8cpp-source.html
277 lines (277 loc) · 44.8 KB
/
checkerboard_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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<!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: checkerboard.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>checkerboard.cpp</h1><a href="checkerboard_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">// checkerboard.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="texture_8h.html">texture.h</a>"</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="paramset_8h.html">paramset.h</a>"</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="sampling_8h.html">sampling.h</a>"</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="shape_8h.html">shape.h</a>"</span>
<a name="l00030"></a>00030 <span class="comment">// Checkerboard2D Private Types</span>
<a name="l00031"></a><a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db1176404115e6134ba334730b3ebc9d8">00031</a> <span class="keyword">enum</span> { <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2dc157bdf0b85a40d2619cbc8bc1ae5fe2">NONE</a>, <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db1176404115e6134ba334730b3ebc9d8">SUPERSAMPLE</a>, <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db9573cd43a5a371e99cb31b53ce6a86d">CLOSEDFORM</a> } <a class="code" href="checkerboard_8cpp.html#4f2e00ab37d4eafe8ed0a5183edc8928">aaMethod</a>;
<a name="l00032"></a>00032 <span class="comment">// CheckerboardTexture Declarations</span>
<a name="l00033"></a><a class="code" href="classCheckerboard2D.html">00033</a> <span class="keyword">template</span> <<span class="keyword">class</span> T> <span class="keyword">class </span><a class="code" href="classCheckerboard2D.html">Checkerboard2D</a> : <span class="keyword">public</span> <a class="code" href="classTexture.html">Texture</a><T> {
<a name="l00034"></a>00034 <span class="keyword">public</span>:
<a name="l00035"></a>00035 <span class="comment">// Checkerboard2D Public Methods</span>
<a name="l00036"></a><a class="code" href="classCheckerboard2D.html#d124ea94d7841c3ffc43181bacedfcbe">00036</a> <a class="code" href="classCheckerboard2D.html#d124ea94d7841c3ffc43181bacedfcbe">Checkerboard2D</a>(<a class="code" href="classTextureMapping2D.html">TextureMapping2D</a> *m,
<a name="l00037"></a>00037 <a class="code" href="classReference.html">Reference</a><<a class="code" href="classTexture.html">Texture<T></a> > c1,
<a name="l00038"></a>00038 <a class="code" href="classReference.html">Reference</a><<a class="code" href="classTexture.html">Texture<T></a> > c2,
<a name="l00039"></a>00039 <span class="keyword">const</span> <span class="keywordtype">string</span> &aa) {
<a name="l00040"></a>00040 <a class="code" href="classCheckerboard2D.html#87e9742a642ea00b829c2fe8b6b929b5">mapping</a> = m;
<a name="l00041"></a>00041 <a class="code" href="classCheckerboard2D.html#5facdaf0de0160d73d1ad748c8ef3b79">tex1</a> = c1;
<a name="l00042"></a>00042 <a class="code" href="classCheckerboard2D.html#0fbfed089d8a3a8e88a82ef3eeb83388">tex2</a> = c2;
<a name="l00043"></a>00043 <span class="comment">// Select anti-aliasing method for _Checkerboard2D_</span>
<a name="l00044"></a>00044 <span class="keywordflow">if</span> (aa == <span class="stringliteral">"none"</span>) <a class="code" href="checkerboard_8cpp.html#4f2e00ab37d4eafe8ed0a5183edc8928">aaMethod</a> = <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2dc157bdf0b85a40d2619cbc8bc1ae5fe2">NONE</a>;
<a name="l00045"></a>00045 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (aa == <span class="stringliteral">"supersample"</span>) <a class="code" href="checkerboard_8cpp.html#4f2e00ab37d4eafe8ed0a5183edc8928">aaMethod</a> = <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db1176404115e6134ba334730b3ebc9d8">SUPERSAMPLE</a>;
<a name="l00046"></a>00046 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (aa == <span class="stringliteral">"closedform"</span>) <a class="code" href="checkerboard_8cpp.html#4f2e00ab37d4eafe8ed0a5183edc8928">aaMethod</a> = <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db9573cd43a5a371e99cb31b53ce6a86d">CLOSEDFORM</a>;
<a name="l00047"></a>00047 <span class="keywordflow">else</span> {
<a name="l00048"></a>00048 <a class="code" href="pbrt_8h.html#79abc2e750c4774bd9d433ad4f6e440a">Warning</a>(<span class="stringliteral">"Anti-aliasing mode \"%s\" not understood "</span>
<a name="l00049"></a>00049 <span class="stringliteral">"by Checkerboard2D, defaulting"</span>
<a name="l00050"></a>00050 <span class="stringliteral">"to \"supersample\""</span>, aa.c_str());
<a name="l00051"></a>00051 <a class="code" href="checkerboard_8cpp.html#4f2e00ab37d4eafe8ed0a5183edc8928">aaMethod</a> = <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db1176404115e6134ba334730b3ebc9d8">SUPERSAMPLE</a>;
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053 }
<a name="l00054"></a><a class="code" href="classCheckerboard2D.html#149bca8be01a314d7486f1f9a21aea8d">00054</a> <a class="code" href="classCheckerboard2D.html#149bca8be01a314d7486f1f9a21aea8d">~Checkerboard2D</a>() {
<a name="l00055"></a>00055 <span class="keyword">delete</span> <a class="code" href="classCheckerboard2D.html#87e9742a642ea00b829c2fe8b6b929b5">mapping</a>;
<a name="l00056"></a>00056 }
<a name="l00057"></a><a class="code" href="classCheckerboard2D.html#105d35682486b0de4c6090704f99edfb">00057</a> T <a class="code" href="classCheckerboard2D.html#105d35682486b0de4c6090704f99edfb">Evaluate</a>(<span class="keyword">const</span> <a class="code" href="structDifferentialGeometry.html">DifferentialGeometry</a> &dg)<span class="keyword"> const </span>{
<a name="l00058"></a>00058 <span class="keywordtype">float</span> s, t, dsdx, dtdx, dsdy, dtdy;
<a name="l00059"></a>00059 <a class="code" href="classCheckerboard2D.html#87e9742a642ea00b829c2fe8b6b929b5">mapping</a>-><a class="code" href="classTextureMapping2D.html#cc29e80d8dfe790cfa22da670ce5529f">Map</a>(dg, &s, &t, &dsdx, &dtdx, &dsdy, &dtdy);
<a name="l00060"></a>00060 <span class="keywordflow">if</span> (<a class="code" href="checkerboard_8cpp.html#4f2e00ab37d4eafe8ed0a5183edc8928">aaMethod</a> == <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db9573cd43a5a371e99cb31b53ce6a86d">CLOSEDFORM</a>) {
<a name="l00061"></a>00061 <span class="comment">// Compute closed form box-filtered _Checkerboard2D_ value</span>
<a name="l00062"></a>00062 <span class="comment">// Evaluate single check if filter is entirely inside one of them</span>
<a name="l00063"></a>00063 <span class="keywordtype">float</span> ds = max(fabsf(dsdx), fabsf(dsdy));
<a name="l00064"></a>00064 <span class="keywordtype">float</span> dt = max(fabsf(dtdx), fabsf(dtdy));
<a name="l00065"></a>00065 <span class="keywordtype">float</span> s0 = s - ds, s1 = s + ds;
<a name="l00066"></a>00066 <span class="keywordtype">float</span> t0 = t - dt, t1 = t + dt;
<a name="l00067"></a>00067 <span class="keywordflow">if</span> (<a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(s0) == <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(s1) &&
<a name="l00068"></a>00068 <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(t0) == <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(t1)) {
<a name="l00069"></a>00069 <span class="comment">// Point sample _Checkerboard2D_</span>
<a name="l00070"></a>00070 <span class="keywordflow">if</span> ((<a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(s) + <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(t)) % 2 == 0)
<a name="l00071"></a>00071 <span class="keywordflow">return</span> <a class="code" href="classCheckerboard2D.html#5facdaf0de0160d73d1ad748c8ef3b79">tex1</a>->Evaluate(dg);
<a name="l00072"></a>00072 <span class="keywordflow">return</span> <a class="code" href="classCheckerboard2D.html#0fbfed089d8a3a8e88a82ef3eeb83388">tex2</a>->Evaluate(dg);
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074 <span class="comment">// Apply box-filter to checkerboard region</span>
<a name="l00075"></a>00075 <span class="preprocessor"> #define BUMPINT(x) \</span>
<a name="l00076"></a>00076 <span class="preprocessor"> (Floor2Int((x)/2) + \</span>
<a name="l00077"></a>00077 <span class="preprocessor"> 2.f * max((x/2)-Floor2Int(x/2) - .5f, 0.f))</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span> <span class="keywordtype">float</span> sint = (<a class="code" href="checkerboard_8cpp.html#e8c5205815b68fc9de4f82cdc21918ed">BUMPINT</a>(s1) - <a class="code" href="checkerboard_8cpp.html#e8c5205815b68fc9de4f82cdc21918ed">BUMPINT</a>(s0)) / (2.f * ds);
<a name="l00079"></a>00079 <span class="keywordtype">float</span> tint = (<a class="code" href="checkerboard_8cpp.html#e8c5205815b68fc9de4f82cdc21918ed">BUMPINT</a>(t1) - <a class="code" href="checkerboard_8cpp.html#e8c5205815b68fc9de4f82cdc21918ed">BUMPINT</a>(t0)) / (2.f * dt);
<a name="l00080"></a>00080 <span class="keywordtype">float</span> area2 = sint + tint - 2.f * sint * tint;
<a name="l00081"></a>00081 <span class="keywordflow">if</span> (ds > 1.f || dt > 1.f)
<a name="l00082"></a>00082 area2 = .5f;
<a name="l00083"></a>00083 <span class="keywordflow">return</span> (1.f - area2) * <a class="code" href="classCheckerboard2D.html#5facdaf0de0160d73d1ad748c8ef3b79">tex1</a>->Evaluate(dg) +
<a name="l00084"></a>00084 area2 * <a class="code" href="classCheckerboard2D.html#0fbfed089d8a3a8e88a82ef3eeb83388">tex2</a>->Evaluate(dg);
<a name="l00085"></a>00085 }
<a name="l00086"></a>00086 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="checkerboard_8cpp.html#4f2e00ab37d4eafe8ed0a5183edc8928">aaMethod</a> == <a class="code" href="checkerboard_8cpp.html#0411cd49bb5b71852cecd93bcbf0ca2db1176404115e6134ba334730b3ebc9d8">SUPERSAMPLE</a>) {
<a name="l00087"></a>00087 <span class="comment">// Supersample _Checkerboard2D_</span>
<a name="l00088"></a>00088 <span class="preprocessor"> #define SQRT_SAMPLES 4</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span><span class="preprocessor"> #define N_SAMPLES (SQRT_SAMPLES * SQRT_SAMPLES)</span>
<a name="l00090"></a>00090 <span class="preprocessor"></span> <span class="keywordtype">float</span> samples[2*<a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>];
<a name="l00091"></a>00091 <a class="code" href="sampling_8cpp.html#098b4ec7fda6ff383ada2b976c9dac30">StratifiedSample2D</a>(samples, <a class="code" href="checkerboard_8cpp.html#5d0de4a232c036b372767dafa0674aea">SQRT_SAMPLES</a>, <a class="code" href="checkerboard_8cpp.html#5d0de4a232c036b372767dafa0674aea">SQRT_SAMPLES</a>);
<a name="l00092"></a>00092 T value = 0.;
<a name="l00093"></a>00093 <span class="keywordtype">float</span> filterSum = 0.;
<a name="l00094"></a>00094 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>; ++i) {
<a name="l00095"></a>00095 <span class="comment">// Compute new differential geometry for supersample location</span>
<a name="l00096"></a>00096 <span class="keywordtype">float</span> dx = samples[2*i] - 0.5f;
<a name="l00097"></a>00097 <span class="keywordtype">float</span> dy = samples[2*i+1] - 0.5f;
<a name="l00098"></a>00098 <a class="code" href="structDifferentialGeometry.html">DifferentialGeometry</a> dgs = dg;
<a name="l00099"></a>00099 dgs.<a class="code" href="structDifferentialGeometry.html#3d5353db1c1a6a93ef6da642d064f46e">p</a> += dx * dgs.<a class="code" href="structDifferentialGeometry.html#307387af96b1b7a98358ea448114d697">dpdx</a> + dy * dgs.<a class="code" href="structDifferentialGeometry.html#d3e6794a920835d56713b3659437fc00">dpdy</a>;
<a name="l00100"></a>00100 dgs.<a class="code" href="structDifferentialGeometry.html#25fb75c2f13a530489cd1776171d3736">u</a> += dx * dgs.<a class="code" href="structDifferentialGeometry.html#ee263cfa99de799c049e33b552ff0b82">dudx</a> + dy * dgs.<a class="code" href="structDifferentialGeometry.html#57f8e45c2aa405802f25f1921ba27edd">dudy</a>;
<a name="l00101"></a>00101 dgs.<a class="code" href="structDifferentialGeometry.html#ad45a8e22d41f9c7116211c3f2372550">v</a> += dx * dgs.<a class="code" href="structDifferentialGeometry.html#f0d770bd2370babb99b4eda972a757e2">dvdx</a> + dy * dgs.<a class="code" href="structDifferentialGeometry.html#7343b4a399c5001c92fad44696060142">dvdy</a>;
<a name="l00102"></a>00102 dgs.<a class="code" href="structDifferentialGeometry.html#ee263cfa99de799c049e33b552ff0b82">dudx</a> /= N_SAMPLES;
<a name="l00103"></a>00103 dgs.<a class="code" href="structDifferentialGeometry.html#57f8e45c2aa405802f25f1921ba27edd">dudy</a> /= N_SAMPLES;
<a name="l00104"></a>00104 dgs.<a class="code" href="structDifferentialGeometry.html#f0d770bd2370babb99b4eda972a757e2">dvdx</a> /= N_SAMPLES;
<a name="l00105"></a>00105 dgs.<a class="code" href="structDifferentialGeometry.html#7343b4a399c5001c92fad44696060142">dvdy</a> /= N_SAMPLES;
<a name="l00106"></a>00106 <span class="comment">// Compute $(s,t)$ for supersample and evaluate sub-texture</span>
<a name="l00107"></a>00107 <span class="keywordtype">float</span> ss, ts, dsdxs, dtdxs, dsdys, dtdys;
<a name="l00108"></a>00108 <a class="code" href="classCheckerboard2D.html#87e9742a642ea00b829c2fe8b6b929b5">mapping</a>-><a class="code" href="classTextureMapping2D.html#cc29e80d8dfe790cfa22da670ce5529f">Map</a>(dgs, &ss, &ts, &dsdxs, &dtdxs, &dsdys, &dtdys);
<a name="l00109"></a>00109 <span class="keywordtype">float</span> wt = expf(-2.f * (dx*dx + dy*dy));
<a name="l00110"></a>00110 filterSum += wt;
<a name="l00111"></a>00111 <span class="keywordflow">if</span> ((<a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(ss) + <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(ts)) % 2 == 0)
<a name="l00112"></a>00112 value += wt * <a class="code" href="classCheckerboard2D.html#5facdaf0de0160d73d1ad748c8ef3b79">tex1</a>->Evaluate(dgs);
<a name="l00113"></a>00113 <span class="keywordflow">else</span>
<a name="l00114"></a>00114 value += wt * <a class="code" href="classCheckerboard2D.html#0fbfed089d8a3a8e88a82ef3eeb83388">tex2</a>->Evaluate(dgs);
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116 <span class="keywordflow">return</span> value / filterSum;
<a name="l00117"></a>00117 <span class="preprocessor"> #undef N_SAMPLES // NOBOOK</span>
<a name="l00118"></a>00118 <span class="preprocessor"></span> }
<a name="l00119"></a>00119 <span class="comment">// Point sample _Checkerboard2D_</span>
<a name="l00120"></a>00120 <span class="keywordflow">if</span> ((<a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(s) + <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(t)) % 2 == 0)
<a name="l00121"></a>00121 <span class="keywordflow">return</span> <a class="code" href="classCheckerboard2D.html#5facdaf0de0160d73d1ad748c8ef3b79">tex1</a>->Evaluate(dg);
<a name="l00122"></a>00122 <span class="keywordflow">return</span> <a class="code" href="classCheckerboard2D.html#0fbfed089d8a3a8e88a82ef3eeb83388">tex2</a>->Evaluate(dg);
<a name="l00123"></a>00123 }
<a name="l00124"></a>00124 <span class="keyword">private</span>:
<a name="l00125"></a>00125 <span class="comment">// Checkerboard2D Private Data</span>
<a name="l00126"></a><a class="code" href="classCheckerboard2D.html#0fbfed089d8a3a8e88a82ef3eeb83388">00126</a> <a class="code" href="classReference.html">Reference<Texture<T></a> > <a class="code" href="classCheckerboard2D.html#5facdaf0de0160d73d1ad748c8ef3b79">tex1</a>, <a class="code" href="classCheckerboard2D.html#0fbfed089d8a3a8e88a82ef3eeb83388">tex2</a>;
<a name="l00127"></a><a class="code" href="classCheckerboard2D.html#87e9742a642ea00b829c2fe8b6b929b5">00127</a> <a class="code" href="classTextureMapping2D.html">TextureMapping2D</a> *<a class="code" href="classCheckerboard2D.html#87e9742a642ea00b829c2fe8b6b929b5">mapping</a>;
<a name="l00128"></a>00128 };
<a name="l00129"></a><a class="code" href="classCheckerboard3D.html">00129</a> <span class="keyword">template</span> <<span class="keyword">class</span> T> <span class="keyword">class </span><a class="code" href="classCheckerboard3D.html">Checkerboard3D</a> : <span class="keyword">public</span> <a class="code" href="classTexture.html">Texture</a><T> {
<a name="l00130"></a>00130 <span class="keyword">public</span>:
<a name="l00131"></a>00131 <span class="comment">// Checkerboard3D Public Methods</span>
<a name="l00132"></a><a class="code" href="classCheckerboard3D.html#22ec29ca1f649c9c711948b7b6add792">00132</a> <a class="code" href="classCheckerboard3D.html#22ec29ca1f649c9c711948b7b6add792">Checkerboard3D</a>(<a class="code" href="classTextureMapping3D.html">TextureMapping3D</a> *m,
<a name="l00133"></a>00133 <a class="code" href="classReference.html">Reference</a><<a class="code" href="classTexture.html">Texture<T></a> > c1,
<a name="l00134"></a>00134 <a class="code" href="classReference.html">Reference</a><<a class="code" href="classTexture.html">Texture<T></a> > c2) {
<a name="l00135"></a>00135 <a class="code" href="classCheckerboard3D.html#11395898c6366a739ca5d57aadbfe906">mapping</a> = m;
<a name="l00136"></a>00136 <a class="code" href="classCheckerboard3D.html#18e5015516aefc1c316193a9e75c9f4f">tex1</a> = c1;
<a name="l00137"></a>00137 <a class="code" href="classCheckerboard3D.html#e586f52c1a880f6cdade46ad14278e07">tex2</a> = c2;
<a name="l00138"></a>00138 }
<a name="l00139"></a><a class="code" href="classCheckerboard3D.html#38e07342a23ae034c99de4eb722381d0">00139</a> T <a class="code" href="classCheckerboard3D.html#38e07342a23ae034c99de4eb722381d0">Evaluate</a>(<span class="keyword">const</span> <a class="code" href="structDifferentialGeometry.html">DifferentialGeometry</a> &dg)<span class="keyword"> const </span>{
<a name="l00140"></a>00140 <span class="comment">// Supersample _Checkerboard3D_</span>
<a name="l00141"></a>00141 <span class="preprocessor"> #define N_SAMPLES 4</span>
<a name="l00142"></a>00142 <span class="preprocessor"></span> <span class="keywordtype">float</span> samples[2*<a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>*<a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>];
<a name="l00143"></a>00143 <a class="code" href="sampling_8cpp.html#098b4ec7fda6ff383ada2b976c9dac30">StratifiedSample2D</a>(samples, <a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>, <a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>);
<a name="l00144"></a>00144 T value = 0.;
<a name="l00145"></a>00145 <span class="keywordtype">float</span> filterSum = 0.;
<a name="l00146"></a>00146 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>*<a class="code" href="checkerboard_8cpp.html#864e696e58717460cdb19e5ce8f7ce20">N_SAMPLES</a>; ++i) {
<a name="l00147"></a>00147 <span class="comment">// Compute new differential geometry for supersample location</span>
<a name="l00148"></a>00148 <span class="keywordtype">float</span> dx = samples[2*i] - 0.5f;
<a name="l00149"></a>00149 <span class="keywordtype">float</span> dy = samples[2*i+1] - 0.5f;
<a name="l00150"></a>00150 <a class="code" href="structDifferentialGeometry.html">DifferentialGeometry</a> dgs = dg;
<a name="l00151"></a>00151 dgs.<a class="code" href="structDifferentialGeometry.html#3d5353db1c1a6a93ef6da642d064f46e">p</a> += dx * dgs.<a class="code" href="structDifferentialGeometry.html#307387af96b1b7a98358ea448114d697">dpdx</a> + dy * dgs.<a class="code" href="structDifferentialGeometry.html#d3e6794a920835d56713b3659437fc00">dpdy</a>;
<a name="l00152"></a>00152 dgs.<a class="code" href="structDifferentialGeometry.html#25fb75c2f13a530489cd1776171d3736">u</a> += dx * dgs.<a class="code" href="structDifferentialGeometry.html#ee263cfa99de799c049e33b552ff0b82">dudx</a> + dy * dgs.<a class="code" href="structDifferentialGeometry.html#57f8e45c2aa405802f25f1921ba27edd">dudy</a>;
<a name="l00153"></a>00153 dgs.<a class="code" href="structDifferentialGeometry.html#ad45a8e22d41f9c7116211c3f2372550">v</a> += dx * dgs.<a class="code" href="structDifferentialGeometry.html#f0d770bd2370babb99b4eda972a757e2">dvdx</a> + dy * dgs.<a class="code" href="structDifferentialGeometry.html#7343b4a399c5001c92fad44696060142">dvdy</a>;
<a name="l00154"></a>00154 dgs.<a class="code" href="structDifferentialGeometry.html#ee263cfa99de799c049e33b552ff0b82">dudx</a> /= N_SAMPLES;
<a name="l00155"></a>00155 dgs.<a class="code" href="structDifferentialGeometry.html#57f8e45c2aa405802f25f1921ba27edd">dudy</a> /= N_SAMPLES;
<a name="l00156"></a>00156 dgs.<a class="code" href="structDifferentialGeometry.html#f0d770bd2370babb99b4eda972a757e2">dvdx</a> /= N_SAMPLES;
<a name="l00157"></a>00157 dgs.<a class="code" href="structDifferentialGeometry.html#7343b4a399c5001c92fad44696060142">dvdy</a> /= N_SAMPLES;
<a name="l00158"></a>00158 <span class="comment">// Compute 3D supersample position and evaluate sub-texture</span>
<a name="l00159"></a>00159 <a class="code" href="classVector.html">Vector</a> dPPdx, dPPdy;
<a name="l00160"></a>00160 <a class="code" href="classPoint.html">Point</a> PP = <a class="code" href="classCheckerboard3D.html#11395898c6366a739ca5d57aadbfe906">mapping</a>-><a class="code" href="classTextureMapping3D.html#93dbc1e5be5a60569c66562ce65c9713">Map</a>(dgs, &dPPdx, &dPPdy);
<a name="l00161"></a>00161 <span class="keywordtype">float</span> wt = expf(-2.f * (dx*dx + dy*dy));
<a name="l00162"></a>00162 filterSum += wt;
<a name="l00163"></a>00163 <span class="keywordflow">if</span> ((<a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(PP.<a class="code" href="classPoint.html#05dfe2dfbde813ad234b514f30e662f1">x</a>) + <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(PP.<a class="code" href="classPoint.html#6101960c8d2d4e8ea1d32c9234bbeb8d">y</a>) + <a class="code" href="pbrt_8h.html#02648670ea7bf29f5782902cd9aa87c1">Floor2Int</a>(PP.<a class="code" href="classPoint.html#9a666531e0e99adff132be93d2407d0c">z</a>)) % 2 == 0)
<a name="l00164"></a>00164 value += wt * <a class="code" href="classCheckerboard3D.html#18e5015516aefc1c316193a9e75c9f4f">tex1</a>->Evaluate(dgs);
<a name="l00165"></a>00165 <span class="keywordflow">else</span>
<a name="l00166"></a>00166 value += wt * <a class="code" href="classCheckerboard3D.html#e586f52c1a880f6cdade46ad14278e07">tex2</a>->Evaluate(dgs);
<a name="l00167"></a>00167 }
<a name="l00168"></a>00168 <span class="keywordflow">return</span> value / filterSum;
<a name="l00169"></a>00169 }
<a name="l00170"></a>00170 <span class="keyword">private</span>:
<a name="l00171"></a>00171 <span class="comment">// Checkerboard3D Private Data</span>
<a name="l00172"></a><a class="code" href="classCheckerboard3D.html#e586f52c1a880f6cdade46ad14278e07">00172</a> <a class="code" href="classReference.html">Reference<Texture<T></a> > <a class="code" href="classCheckerboard3D.html#18e5015516aefc1c316193a9e75c9f4f">tex1</a>, <a class="code" href="classCheckerboard3D.html#e586f52c1a880f6cdade46ad14278e07">tex2</a>;
<a name="l00173"></a><a class="code" href="classCheckerboard3D.html#11395898c6366a739ca5d57aadbfe906">00173</a> <a class="code" href="classTextureMapping3D.html">TextureMapping3D</a> *<a class="code" href="classCheckerboard3D.html#11395898c6366a739ca5d57aadbfe906">mapping</a>;
<a name="l00174"></a>00174 };
<a name="l00175"></a>00175 <span class="comment">// CheckerboardTexture Method Definitions</span>
<a name="l00176"></a><a class="code" href="checkerboard_8cpp.html#a327196792a520cf6474d6d070066738">00176</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="classTexture.html">Texture<float></a> * <a class="code" href="bilerp_8cpp.html#a327196792a520cf6474d6d070066738">CreateFloatTexture</a>(<span class="keyword">const</span> <a class="code" href="classTransform.html">Transform</a> &tex2world,
<a name="l00177"></a>00177 <span class="keyword">const</span> <a class="code" href="classTextureParams.html">TextureParams</a> &tp) {
<a name="l00178"></a>00178 <span class="keywordtype">int</span> dim = tp.<a class="code" href="classTextureParams.html#ca5ac737691fa5765644683fd147acb8">FindInt</a>(<span class="stringliteral">"dimension"</span>, 2);
<a name="l00179"></a>00179 <span class="keywordflow">if</span> (dim != 2 && dim != 3) {
<a name="l00180"></a>00180 <a class="code" href="pbrt_8h.html#d1a16fc9ced4ddc376b9d3e6607be15e">Error</a>(<span class="stringliteral">"%d dimensional checkerboard texture not supported"</span>, dim);
<a name="l00181"></a>00181 <span class="keywordflow">return</span> NULL;
<a name="l00182"></a>00182 }
<a name="l00183"></a>00183 <a class="code" href="classReference.html">Reference<Texture<float></a> > tex1 = tp.<a class="code" href="classTextureParams.html#d416140fa1530ed88480419f79be07e0">GetFloatTexture</a>(<span class="stringliteral">"tex1"</span>, 1.f);
<a name="l00184"></a>00184 <a class="code" href="classReference.html">Reference<Texture<float></a> > tex2 = tp.<a class="code" href="classTextureParams.html#d416140fa1530ed88480419f79be07e0">GetFloatTexture</a>(<span class="stringliteral">"tex2"</span>, 0.f);
<a name="l00185"></a>00185 <span class="keywordflow">if</span> (dim == 2) {
<a name="l00186"></a>00186 <span class="comment">// Initialize 2D texture mapping _map_ from _tp_</span>
<a name="l00187"></a>00187 <a class="code" href="classTextureMapping2D.html">TextureMapping2D</a> *map = NULL;
<a name="l00188"></a>00188 <span class="keywordtype">string</span> type = tp.<a class="code" href="classTextureParams.html#bdf8f09f3693e60261da0493d5e065b8">FindString</a>(<span class="stringliteral">"mapping"</span>);
<a name="l00189"></a>00189 <span class="keywordflow">if</span> (type == <span class="stringliteral">""</span> || type == <span class="stringliteral">"uv"</span>) {
<a name="l00190"></a>00190 <span class="keywordtype">float</span> su = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"uscale"</span>, 1.);
<a name="l00191"></a>00191 <span class="keywordtype">float</span> sv = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"vscale"</span>, 1.);
<a name="l00192"></a>00192 <span class="keywordtype">float</span> du = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"udelta"</span>, 0.);
<a name="l00193"></a>00193 <span class="keywordtype">float</span> dv = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"vdelta"</span>, 0.);
<a name="l00194"></a>00194 map = <span class="keyword">new</span> <a class="code" href="classUVMapping2D.html">UVMapping2D</a>(su, sv, du, dv);
<a name="l00195"></a>00195 }
<a name="l00196"></a>00196 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (type == <span class="stringliteral">"spherical"</span>) map = <span class="keyword">new</span> <a class="code" href="classSphericalMapping2D.html">SphericalMapping2D</a>(tex2world.<a class="code" href="classTransform.html#ced6cc3fb16b20846fcee5aaf6432f49">GetInverse</a>());
<a name="l00197"></a>00197 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (type == <span class="stringliteral">"cylindrical"</span>) map = <span class="keyword">new</span> <a class="code" href="classCylindricalMapping2D.html">CylindricalMapping2D</a>(tex2world.<a class="code" href="classTransform.html#ced6cc3fb16b20846fcee5aaf6432f49">GetInverse</a>());
<a name="l00198"></a>00198 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (type == <span class="stringliteral">"planar"</span>)
<a name="l00199"></a>00199 map = <span class="keyword">new</span> <a class="code" href="classPlanarMapping2D.html">PlanarMapping2D</a>(tp.<a class="code" href="classTextureParams.html#1625f430ef9f25383446562fecbb27db">FindVector</a>(<span class="stringliteral">"v1"</span>, <a class="code" href="classVector.html">Vector</a>(1,0,0)),
<a name="l00200"></a>00200 tp.<a class="code" href="classTextureParams.html#1625f430ef9f25383446562fecbb27db">FindVector</a>(<span class="stringliteral">"v2"</span>, <a class="code" href="classVector.html">Vector</a>(0,1,0)),
<a name="l00201"></a>00201 tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"udelta"</span>, 0.f), tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"vdelta"</span>, 0.f));
<a name="l00202"></a>00202 <span class="keywordflow">else</span> {
<a name="l00203"></a>00203 <a class="code" href="pbrt_8h.html#d1a16fc9ced4ddc376b9d3e6607be15e">Error</a>(<span class="stringliteral">"2D texture mapping \"%s\" unknown"</span>, type.c_str());
<a name="l00204"></a>00204 map = <span class="keyword">new</span> <a class="code" href="classUVMapping2D.html">UVMapping2D</a>;
<a name="l00205"></a>00205 }
<a name="l00206"></a>00206 <span class="keywordtype">string</span> aamode = tp.<a class="code" href="classTextureParams.html#bdf8f09f3693e60261da0493d5e065b8">FindString</a>(<span class="stringliteral">"aamode"</span>);
<a name="l00207"></a>00207 <span class="keywordflow">if</span> (aamode == <span class="stringliteral">""</span>) aamode = <span class="stringliteral">"closedform"</span>;
<a name="l00208"></a>00208 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCheckerboard2D.html">Checkerboard2D<float></a>(map, tex1, tex2, aamode);
<a name="l00209"></a>00209 }
<a name="l00210"></a>00210 <span class="keywordflow">else</span> {
<a name="l00211"></a>00211 <span class="comment">// Initialize 3D texture mapping _map_ from _tp_</span>
<a name="l00212"></a>00212 <a class="code" href="classTextureMapping3D.html">TextureMapping3D</a> *map = <span class="keyword">new</span> <a class="code" href="classIdentityMapping3D.html">IdentityMapping3D</a>(tex2world);
<a name="l00213"></a>00213 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCheckerboard3D.html">Checkerboard3D<float></a>(map, tex1, tex2);
<a name="l00214"></a>00214 }
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216
<a name="l00217"></a><a class="code" href="checkerboard_8cpp.html#310da60fe3129572e26e896019bb4f7f">00217</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="classTexture.html">Texture<Spectrum></a> * <a class="code" href="bilerp_8cpp.html#310da60fe3129572e26e896019bb4f7f">CreateSpectrumTexture</a>(<span class="keyword">const</span> <a class="code" href="classTransform.html">Transform</a> &tex2world,
<a name="l00218"></a>00218 <span class="keyword">const</span> <a class="code" href="classTextureParams.html">TextureParams</a> &tp) {
<a name="l00219"></a>00219 <span class="keywordtype">int</span> dim = tp.<a class="code" href="classTextureParams.html#ca5ac737691fa5765644683fd147acb8">FindInt</a>(<span class="stringliteral">"dimension"</span>, 2);
<a name="l00220"></a>00220 <span class="keywordflow">if</span> (dim != 2 && dim != 3) {
<a name="l00221"></a>00221 <a class="code" href="pbrt_8h.html#d1a16fc9ced4ddc376b9d3e6607be15e">Error</a>(<span class="stringliteral">"%d dimensional checkerboard texture not supported"</span>, dim);
<a name="l00222"></a>00222 <span class="keywordflow">return</span> NULL;
<a name="l00223"></a>00223 }
<a name="l00224"></a>00224 <a class="code" href="classReference.html">Reference<Texture<Spectrum></a> > tex1 = tp.<a class="code" href="classTextureParams.html#974170db9e1829ef01a082ad7fdf2bc3">GetSpectrumTexture</a>(<span class="stringliteral">"tex1"</span>, 1.f);
<a name="l00225"></a>00225 <a class="code" href="classReference.html">Reference<Texture<Spectrum></a> > tex2 = tp.<a class="code" href="classTextureParams.html#974170db9e1829ef01a082ad7fdf2bc3">GetSpectrumTexture</a>(<span class="stringliteral">"tex2"</span>, 0.f);
<a name="l00226"></a>00226 <span class="keywordflow">if</span> (dim == 2) {
<a name="l00227"></a>00227 <span class="comment">// Initialize 2D texture mapping _map_ from _tp_</span>
<a name="l00228"></a>00228 <a class="code" href="classTextureMapping2D.html">TextureMapping2D</a> *map = NULL;
<a name="l00229"></a>00229 <span class="keywordtype">string</span> type = tp.<a class="code" href="classTextureParams.html#bdf8f09f3693e60261da0493d5e065b8">FindString</a>(<span class="stringliteral">"mapping"</span>);
<a name="l00230"></a>00230 <span class="keywordflow">if</span> (type == <span class="stringliteral">""</span> || type == <span class="stringliteral">"uv"</span>) {
<a name="l00231"></a>00231 <span class="keywordtype">float</span> su = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"uscale"</span>, 1.);
<a name="l00232"></a>00232 <span class="keywordtype">float</span> sv = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"vscale"</span>, 1.);
<a name="l00233"></a>00233 <span class="keywordtype">float</span> du = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"udelta"</span>, 0.);
<a name="l00234"></a>00234 <span class="keywordtype">float</span> dv = tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"vdelta"</span>, 0.);
<a name="l00235"></a>00235 map = <span class="keyword">new</span> <a class="code" href="classUVMapping2D.html">UVMapping2D</a>(su, sv, du, dv);
<a name="l00236"></a>00236 }
<a name="l00237"></a>00237 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (type == <span class="stringliteral">"spherical"</span>) map = <span class="keyword">new</span> <a class="code" href="classSphericalMapping2D.html">SphericalMapping2D</a>(tex2world.<a class="code" href="classTransform.html#ced6cc3fb16b20846fcee5aaf6432f49">GetInverse</a>());
<a name="l00238"></a>00238 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (type == <span class="stringliteral">"cylindrical"</span>) map = <span class="keyword">new</span> <a class="code" href="classCylindricalMapping2D.html">CylindricalMapping2D</a>(tex2world.<a class="code" href="classTransform.html#ced6cc3fb16b20846fcee5aaf6432f49">GetInverse</a>());
<a name="l00239"></a>00239 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (type == <span class="stringliteral">"planar"</span>)
<a name="l00240"></a>00240 map = <span class="keyword">new</span> <a class="code" href="classPlanarMapping2D.html">PlanarMapping2D</a>(tp.<a class="code" href="classTextureParams.html#1625f430ef9f25383446562fecbb27db">FindVector</a>(<span class="stringliteral">"v1"</span>, <a class="code" href="classVector.html">Vector</a>(1,0,0)),
<a name="l00241"></a>00241 tp.<a class="code" href="classTextureParams.html#1625f430ef9f25383446562fecbb27db">FindVector</a>(<span class="stringliteral">"v2"</span>, <a class="code" href="classVector.html">Vector</a>(0,1,0)),
<a name="l00242"></a>00242 tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"udelta"</span>, 0.f), tp.<a class="code" href="classTextureParams.html#515fcaebd83191597efb444595738411">FindFloat</a>(<span class="stringliteral">"vdelta"</span>, 0.f));
<a name="l00243"></a>00243 <span class="keywordflow">else</span> {
<a name="l00244"></a>00244 <a class="code" href="pbrt_8h.html#d1a16fc9ced4ddc376b9d3e6607be15e">Error</a>(<span class="stringliteral">"2D texture mapping \"%s\" unknown"</span>, type.c_str());
<a name="l00245"></a>00245 map = <span class="keyword">new</span> <a class="code" href="classUVMapping2D.html">UVMapping2D</a>;
<a name="l00246"></a>00246 }
<a name="l00247"></a>00247 <span class="keywordtype">string</span> aamode = tp.<a class="code" href="classTextureParams.html#bdf8f09f3693e60261da0493d5e065b8">FindString</a>(<span class="stringliteral">"aamode"</span>);
<a name="l00248"></a>00248 <span class="keywordflow">if</span> (aamode == <span class="stringliteral">""</span>) aamode = <span class="stringliteral">"closedform"</span>;
<a name="l00249"></a>00249 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCheckerboard2D.html">Checkerboard2D<Spectrum></a>(map, tex1, tex2, aamode);
<a name="l00250"></a>00250 }
<a name="l00251"></a>00251 <span class="keywordflow">else</span> {
<a name="l00252"></a>00252 <span class="comment">// Initialize 3D texture mapping _map_ from _tp_</span>
<a name="l00253"></a>00253 <a class="code" href="classTextureMapping3D.html">TextureMapping3D</a> *map = <span class="keyword">new</span> <a class="code" href="classIdentityMapping3D.html">IdentityMapping3D</a>(tex2world);
<a name="l00254"></a>00254 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classCheckerboard3D.html">Checkerboard3D<Spectrum></a>(map, tex1, tex2);
<a name="l00255"></a>00255 }
<a name="l00256"></a>00256 }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jul 20 17:31:52 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>