pbrt 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ module PBRT
2
+ class Builder
3
+ class Accelerator
4
+ def initialize(builder)
5
+ @builder = builder
6
+ end
7
+
8
+ def bvh(params = {})
9
+ write Statement.variadic("Accelerator", "bvh", ParameterList.from(
10
+ params,
11
+
12
+ maxnodeprims: :integer,
13
+ splitmethod: :string,
14
+ ))
15
+ end
16
+
17
+ def kdtree(params = {})
18
+ write Statement.variadic("Accelerator", "kdtree", ParameterList.from(
19
+ params,
20
+
21
+ intersectcost: :integer,
22
+ traversalcost: :integer,
23
+ emptybonus: :float,
24
+ maxprims: :integer,
25
+ maxdepth: :integer,
26
+ ))
27
+ end
28
+
29
+ private
30
+
31
+ def write(statement)
32
+ @builder.write(statement)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ module PBRT
2
+ class Builder
3
+ class AreaLightSource
4
+ def initialize(builder)
5
+ @builder = builder
6
+ end
7
+
8
+ def diffuse(params = {})
9
+ write Statement.variadic("AreaLightSource", "diffuse", ParameterList.from(
10
+ params,
11
+
12
+ L: :spectrum,
13
+ twosided: :bool,
14
+ samples: :integer,
15
+ ))
16
+ end
17
+
18
+ private
19
+
20
+ def write(statement)
21
+ @builder.write(statement)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,67 @@
1
+ module PBRT
2
+ class Builder
3
+ class Camera
4
+ def initialize(builder)
5
+ @builder = builder
6
+ end
7
+
8
+ def environment(params = {})
9
+ write Statement.variadic("Camera", "environment", ParameterList.from(
10
+ params,
11
+
12
+ shutteropen: :float,
13
+ shutterclose: :float,
14
+ frameaspectratio: :float,
15
+ screenwindow: :float,
16
+ ))
17
+ end
18
+
19
+ def orthographic(params = {})
20
+ write Statement.variadic("Camera", "orthographic", ParameterList.from(
21
+ params,
22
+
23
+ shutteropen: :float,
24
+ shutterclose: :float,
25
+ frameaspectratio: :float,
26
+ screenwindow: :float,
27
+ lensradius: :float,
28
+ focaldistance: :float,
29
+ ))
30
+ end
31
+
32
+ def perspective(params = {})
33
+ write Statement.variadic("Camera", "perspective", ParameterList.from(
34
+ params,
35
+
36
+ shutteropen: :float,
37
+ shutterclose: :float,
38
+ frameaspectratio: :float,
39
+ screenwindow: :float,
40
+ lensradius: :float,
41
+ focaldistance: :float,
42
+ fov: :float,
43
+ halffov: :float,
44
+ ))
45
+ end
46
+
47
+ def realistic(params = {})
48
+ write Statement.variadic("Camera", "realistic", ParameterList.from(
49
+ params,
50
+
51
+ shutteropen: :float,
52
+ shutterclose: :float,
53
+ lensfile: :string,
54
+ aperturediameter: :float,
55
+ focusdistance: :float,
56
+ simpleweighting: :bool,
57
+ ))
58
+ end
59
+
60
+ private
61
+
62
+ def write(statement)
63
+ @builder.write(statement)
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,29 @@
1
+ module PBRT
2
+ class Builder
3
+ class Film
4
+ def initialize(builder)
5
+ @builder = builder
6
+ end
7
+
8
+ def image(params = {})
9
+ write Statement.variadic("Film", "image", ParameterList.from(
10
+ params,
11
+
12
+ xresolution: :integer,
13
+ yresolution: :integer,
14
+ cropwindow: :float,
15
+ scale: :float,
16
+ maxsampleluminance: :float,
17
+ diagonal: :float,
18
+ filename: :string,
19
+ ))
20
+ end
21
+
22
+ private
23
+
24
+ def write(statement)
25
+ @builder.write(statement)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,82 @@
1
+ module PBRT
2
+ class Builder
3
+ class Integrator
4
+ def initialize(builder)
5
+ @builder = builder
6
+ end
7
+
8
+ def bdpt(params = {})
9
+ write Statement.variadic("Integrator", "bdpt", ParameterList.from(
10
+ params,
11
+
12
+ maxdepth: :integer,
13
+ pixelbounds: :integer,
14
+ lightsamplestrategy: :string,
15
+ visualizestrategies: :bool,
16
+ visualizeweights: :bool,
17
+ ))
18
+ end
19
+
20
+ def directlighting(params = {})
21
+ write Statement.variadic("Integrator", "directlighting", ParameterList.from(
22
+ params,
23
+
24
+ strategy: :string,
25
+ maxdepth: :integer,
26
+ pixelbounds: :integer,
27
+ ))
28
+ end
29
+
30
+ def mlt(params = {})
31
+ write Statement.variadic("Integrator", "mlt", ParameterList.from(
32
+ params,
33
+
34
+ maxdepth: :integer,
35
+ bootstrapsamples: :integer,
36
+ chains: :integer,
37
+ mutationsperpixel: :integer,
38
+ largestepprobability: :float,
39
+ sigma: :float,
40
+ ))
41
+ end
42
+
43
+ def path(params = {})
44
+ write Statement.variadic("Integrator", "path", ParameterList.from(
45
+ params,
46
+
47
+ maxdepth: :integer,
48
+ pixelbounds: :integer,
49
+ rrthreshold: :float,
50
+ lightsamplestrategy: :string,
51
+ ))
52
+ end
53
+
54
+ def sppm(params = {})
55
+ write Statement.variadic("Integrator", "sppm", ParameterList.from(
56
+ params,
57
+
58
+ maxdepth: :integer,
59
+ iterations: :integer,
60
+ photonsperiteration: :integer,
61
+ imagewritefrequency: :integer,
62
+ radius: :float,
63
+ ))
64
+ end
65
+
66
+ def whitted(params = {})
67
+ write Statement.variadic("Integrator", "whitted", ParameterList.from(
68
+ params,
69
+
70
+ maxdepth: :integer,
71
+ pixelbounds: :integer,
72
+ ))
73
+ end
74
+
75
+ private
76
+
77
+ def write(statement)
78
+ @builder.write(statement)
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,81 @@
1
+ module PBRT
2
+ class Builder
3
+ class LightSource
4
+ def initialize(builder)
5
+ @builder = builder
6
+ end
7
+
8
+ def distant(params = {})
9
+ write Statement.variadic("LightSource", "distant", ParameterList.from(
10
+ params,
11
+
12
+ scale: :spectrum,
13
+ L: :spectrum,
14
+ from: :point3,
15
+ to: :point3,
16
+ ))
17
+ end
18
+
19
+ def goniometric(params = {})
20
+ write Statement.variadic("LightSource", "goniometric", ParameterList.from(
21
+ params,
22
+
23
+ scale: :spectrum,
24
+ I: :spectrum,
25
+ mapname: :string,
26
+ ))
27
+ end
28
+
29
+ def infinite(params = {})
30
+ write Statement.variadic("LightSource", "infinite", ParameterList.from(
31
+ params,
32
+
33
+ scale: :spectrum,
34
+ L: :spectrum,
35
+ samples: :integer,
36
+ mapname: :string,
37
+ ))
38
+ end
39
+
40
+ def point(params = {})
41
+ write Statement.variadic("LightSource", "point", ParameterList.from(
42
+ params,
43
+
44
+ scale: :spectrum,
45
+ I: :spectrum,
46
+ from: :point3,
47
+ ))
48
+ end
49
+
50
+ def projection(params = {})
51
+ write Statement.variadic("LightSource", "projection", ParameterList.from(
52
+ params,
53
+
54
+ scale: :spectrum,
55
+ I: :spectrum,
56
+ fov: :float,
57
+ mapname: :string,
58
+ ))
59
+ end
60
+
61
+ def spot(params = {})
62
+ write Statement.variadic("LightSource", "spot", ParameterList.from(
63
+ params,
64
+
65
+ scale: :spectrum,
66
+ I: :spectrum,
67
+ from: :point3,
68
+ to: :point3,
69
+ coneangle: :float,
70
+ conedeltaangle: :float,
71
+ ))
72
+ end
73
+
74
+ private
75
+
76
+ def write(statement)
77
+ @builder.write(statement)
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,266 @@
1
+ module PBRT
2
+ class Builder
3
+ class Material
4
+ def initialize(builder)
5
+ @builder = builder
6
+ end
7
+
8
+ def disney(params = {})
9
+ write Statement.variadic("Material", "disney", ParameterList.from(
10
+ params,
11
+
12
+ bumpmap: :float_texture,
13
+ color: :spectrum_texture,
14
+ anisotropic: :float_texture,
15
+ clearcoat: :float_texture,
16
+ clearcoatgloss: :float_texture,
17
+ eta: :float_texture,
18
+ metallic: :float_texture,
19
+ roughness: :float_texture,
20
+ scatterdistance: :spectrum_texture,
21
+ sheen: :float_texture,
22
+ sheentint: :float_texture,
23
+ spectrans: :float_texture,
24
+ speculartint: :float_texture,
25
+ thin: :bool,
26
+ difftrans: :spectrum_texture,
27
+ flatness: :spectrum_texture,
28
+ ))
29
+ end
30
+
31
+ def fourier(params = {})
32
+ write Statement.variadic("Material", "fourier", ParameterList.from(
33
+ params,
34
+
35
+ bumpmap: :float_texture,
36
+ bsdffile: :string,
37
+ ))
38
+ end
39
+
40
+ def glass(params = {})
41
+ write Statement.variadic("Material", "glass", ParameterList.from(
42
+ params,
43
+
44
+ bumpmap: :float_texture,
45
+ Kr: :spectrum_texture,
46
+ Kt: :spectrum_texture,
47
+ eta: :float_texture,
48
+ uroughness: :float_texture,
49
+ vroughness: :float_texture,
50
+ remaproughness: :bool,
51
+ ))
52
+ end
53
+
54
+ def hair(params = {})
55
+ write Statement.variadic("Material", "hair", ParameterList.from(
56
+ params,
57
+
58
+ bumpmap: :float_texture,
59
+ sigma_a: :spectrum_texture,
60
+ color: :spectrum_texture,
61
+ eumelanin: :float_texture,
62
+ pheomelanin: :float_texture,
63
+ eta: :float_texture,
64
+ beta_m: :float_texture,
65
+ beta_n: :float_texture,
66
+ alpha: :float_texture,
67
+ ))
68
+ end
69
+
70
+ def kdsubsurface(params = {})
71
+ write Statement.variadic("Material", "kdsubsurface", ParameterList.from(
72
+ params,
73
+
74
+ bumpmap: :float_texture,
75
+ Kd: :spectrum_texture,
76
+ mfp: :float_texture,
77
+ eta: :float_texture,
78
+ Kr: :spectrum_texture,
79
+ Kt: :spectrum_texture,
80
+ uroughness: :float_texture,
81
+ vroughness: :float_texture,
82
+ remaproughness: :bool,
83
+ ))
84
+ end
85
+
86
+ def matte(params = {})
87
+ write Statement.variadic("Material", "matte", ParameterList.from(
88
+ params,
89
+
90
+ bumpmap: :float_texture,
91
+ Kd: :spectrum_texture,
92
+ sigma: :float_texture,
93
+ ))
94
+ end
95
+
96
+ def metal(params = {})
97
+ write Statement.variadic("Material", "metal", ParameterList.from(
98
+ params,
99
+
100
+ bumpmap: :float_texture,
101
+ eta: :spectrum_texture,
102
+ k: :spectrum_texture,
103
+ roughness: :float_texture,
104
+ uroughness: :float_texture,
105
+ vroughness: :float_texture,
106
+ remaproughness: :bool,
107
+ ))
108
+ end
109
+
110
+ def mirror(params = {})
111
+ write Statement.variadic("Material", "mirror", ParameterList.from(
112
+ params,
113
+
114
+ bumpmap: :float_texture,
115
+ Kr: :spectrum_texture,
116
+ ))
117
+ end
118
+
119
+ def mix(params = {})
120
+ write Statement.variadic("Material", "mix", ParameterList.from(
121
+ params,
122
+
123
+ bumpmap: :float_texture,
124
+ amount: :spectrum_texture,
125
+ namedmaterial1: :string,
126
+ namedmaterial2: :string,
127
+ ))
128
+ end
129
+
130
+ def none(params = {})
131
+ write Statement.variadic("Material", "none", ParameterList.from(
132
+ params,
133
+ bumpmap: :float_texture,
134
+ ))
135
+ end
136
+
137
+ def plastic(params = {})
138
+ write Statement.variadic("Material", "plastic", ParameterList.from(
139
+ params,
140
+
141
+ bumpmap: :float_texture,
142
+ Kd: :spectrum_texture,
143
+ Ks: :spectrum_texture,
144
+ roughness: :float_texture,
145
+ remaproughness: :bool,
146
+ ))
147
+ end
148
+
149
+ def substrate(params = {})
150
+ write Statement.variadic("Material", "substrate", ParameterList.from(
151
+ params,
152
+
153
+ bumpmap: :float_texture,
154
+ Kd: :spectrum_texture,
155
+ Ks: :spectrum_texture,
156
+ uroughness: :float_texture,
157
+ vroughness: :float_texture,
158
+ remaproughness: :bool,
159
+ ))
160
+ end
161
+
162
+ def subsurface(params = {})
163
+ write Statement.variadic("Material", "subsurface", ParameterList.from(
164
+ params,
165
+
166
+ bumpmap: :float_texture,
167
+ name: :string,
168
+ sigma_a: :spectrum_texture,
169
+ sigma_prime_s: :spectrum_texture,
170
+ scale: :float,
171
+ eta: :float_texture,
172
+ Kr: :spectrum_texture,
173
+ Kt: :spectrum_texture,
174
+ uroughness: :float_texture,
175
+ vroughness: :float_texture,
176
+ remaproughness: :bool,
177
+ ))
178
+ end
179
+
180
+ def translucent(params = {})
181
+ write Statement.variadic("Material", "translucent", ParameterList.from(
182
+ params,
183
+
184
+ bumpmap: :float_texture,
185
+ Kd: :spectrum_texture,
186
+ Ks: :spectrum_texture,
187
+ reflect: :spectrum_texture,
188
+ transmit: :spectrum_texture,
189
+ roughness: :float_texture,
190
+ remaproughness: :bool,
191
+ ))
192
+ end
193
+
194
+ def uber(params = {})
195
+ write Statement.variadic("Material", "uber", ParameterList.from(
196
+ params,
197
+
198
+ bumpmap: :float_texture,
199
+ Kd: :spectrum_texture,
200
+ Ks: :spectrum_texture,
201
+ Kr: :spectrum_texture,
202
+ Kt: :spectrum_texture,
203
+ roughness: :float_texture,
204
+ uroughness: :float_texture,
205
+ vroughness: :float_texture,
206
+ eta: :float_texture,
207
+ opacity: :spectrum_texture,
208
+ remaproughness: :bool,
209
+ ))
210
+ end
211
+
212
+ private
213
+
214
+ def write(statement)
215
+ @builder.write(statement)
216
+ end
217
+
218
+ ALL_PARAMS = {
219
+ Kd: :spectrum_texture,
220
+ Kr: :spectrum_texture,
221
+ Ks: :spectrum_texture,
222
+ Kt: :spectrum_texture,
223
+ alpha: :float_texture,
224
+ amount: :spectrum_texture,
225
+ anisotropic: :float_texture,
226
+ beta_m: :float_texture,
227
+ beta_n: :float_texture,
228
+ bsdffile: :string,
229
+ bumpmap: :float_texture,
230
+ clearcoat: :float_texture,
231
+ clearcoatgloss: :float_texture,
232
+ color: :spectrum_texture,
233
+ difftrans: :spectrum_texture,
234
+ eumelanin: :float_texture,
235
+ flatness: :spectrum_texture,
236
+ k: :spectrum_texture,
237
+ metallic: :float_texture,
238
+ mfp: :float_texture,
239
+ name: :string,
240
+ namedmaterial1: :string,
241
+ namedmaterial2: :string,
242
+ opacity: :spectrum_texture,
243
+ pheomelanin: :float_texture,
244
+ reflect: :spectrum_texture,
245
+ remaproughness: :bool,
246
+ roughness: :float_texture,
247
+ scale: :float,
248
+ scatterdistance: :spectrum_texture,
249
+ sheen: :float_texture,
250
+ sheentint: :float_texture,
251
+ sigma: :float_texture,
252
+ sigma_a: :spectrum_texture,
253
+ sigma_prime_s: :spectrum_texture,
254
+ spectrans: :float_texture,
255
+ speculartint: :float_texture,
256
+ thin: :bool,
257
+ transmit: :spectrum_texture,
258
+ uroughness: :float_texture,
259
+ vroughness: :float_texture,
260
+
261
+ # eta appears as both a float_texture and spectrum_texture
262
+ eta: :texture,
263
+ }.freeze
264
+ end
265
+ end
266
+ end