pbrt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +267 -0
- data/lib/pbrt.rb +26 -0
- data/lib/pbrt/builder.rb +184 -0
- data/lib/pbrt/builder/accelerator.rb +36 -0
- data/lib/pbrt/builder/area_light_source.rb +25 -0
- data/lib/pbrt/builder/camera.rb +67 -0
- data/lib/pbrt/builder/film.rb +29 -0
- data/lib/pbrt/builder/integrator.rb +82 -0
- data/lib/pbrt/builder/light_source.rb +81 -0
- data/lib/pbrt/builder/material.rb +266 -0
- data/lib/pbrt/builder/named_material.rb +24 -0
- data/lib/pbrt/builder/named_medium.rb +46 -0
- data/lib/pbrt/builder/pixel_filter.rb +64 -0
- data/lib/pbrt/builder/sampler.rb +60 -0
- data/lib/pbrt/builder/shape.rb +171 -0
- data/lib/pbrt/builder/texture.rb +167 -0
- data/lib/pbrt/parameter.rb +12 -0
- data/lib/pbrt/parameter_list.rb +45 -0
- data/lib/pbrt/signature.rb +39 -0
- data/lib/pbrt/spectrum.rb +29 -0
- data/lib/pbrt/statement.rb +11 -0
- data/lib/pbrt/statement/fixed_size.rb +28 -0
- data/lib/pbrt/statement/variadic.rb +15 -0
- data/lib/pbrt/texture.rb +63 -0
- data/lib/pbrt/values.rb +25 -0
- metadata +82 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
module PBRT
|
2
|
+
class Builder
|
3
|
+
class NamedMaterial
|
4
|
+
def initialize(builder, name)
|
5
|
+
@builder = builder
|
6
|
+
@name = name
|
7
|
+
end
|
8
|
+
|
9
|
+
def method_missing(method, *args)
|
10
|
+
Material.new(self).public_send(method, *args)
|
11
|
+
end
|
12
|
+
|
13
|
+
def write(statement)
|
14
|
+
@builder.write(modified(statement))
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def modified(statement)
|
20
|
+
statement.to_s.sub("Material", %(MakeNamedMaterial "#@name" "string type"))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module PBRT
|
2
|
+
class Builder
|
3
|
+
class NamedMedium
|
4
|
+
def initialize(builder, name)
|
5
|
+
@builder = builder
|
6
|
+
@directive = %(MakeNamedMedium "#{name}" "string type")
|
7
|
+
end
|
8
|
+
|
9
|
+
def homogeneous(params = {})
|
10
|
+
write Statement.variadic(@directive, "homogeneous", ParameterList.from(
|
11
|
+
params,
|
12
|
+
|
13
|
+
sigma_a: :spectrum,
|
14
|
+
sigma_s: :spectrum,
|
15
|
+
preset: :string,
|
16
|
+
g: :float,
|
17
|
+
scale: :float,
|
18
|
+
))
|
19
|
+
end
|
20
|
+
|
21
|
+
def heterogeneous(params = {})
|
22
|
+
write Statement.variadic(@directive, "heterogeneous", ParameterList.from(
|
23
|
+
params,
|
24
|
+
|
25
|
+
sigma_a: :spectrum,
|
26
|
+
sigma_s: :spectrum,
|
27
|
+
preset: :string,
|
28
|
+
g: :float,
|
29
|
+
scale: :float,
|
30
|
+
p0: :point3,
|
31
|
+
p1: :point3,
|
32
|
+
nx: :integer,
|
33
|
+
ny: :integer,
|
34
|
+
nz: :integer,
|
35
|
+
density: :float,
|
36
|
+
))
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def write(statement)
|
42
|
+
@builder.write(statement)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module PBRT
|
2
|
+
class Builder
|
3
|
+
class PixelFilter
|
4
|
+
def initialize(builder)
|
5
|
+
@builder = builder
|
6
|
+
end
|
7
|
+
|
8
|
+
def box(params = {})
|
9
|
+
write Statement.variadic("PixelFilter", "box", ParameterList.from(
|
10
|
+
params,
|
11
|
+
|
12
|
+
xwidth: :float,
|
13
|
+
ywidth: :float,
|
14
|
+
))
|
15
|
+
end
|
16
|
+
|
17
|
+
def gaussian(params = {})
|
18
|
+
write Statement.variadic("PixelFilter", "gaussian", ParameterList.from(
|
19
|
+
params,
|
20
|
+
|
21
|
+
xwidth: :float,
|
22
|
+
ywidth: :float,
|
23
|
+
alpha: :float,
|
24
|
+
))
|
25
|
+
end
|
26
|
+
|
27
|
+
def mitchell(params = {})
|
28
|
+
write Statement.variadic("PixelFilter", "mitchell", ParameterList.from(
|
29
|
+
params,
|
30
|
+
|
31
|
+
xwidth: :float,
|
32
|
+
ywidth: :float,
|
33
|
+
B: :float,
|
34
|
+
C: :float,
|
35
|
+
))
|
36
|
+
end
|
37
|
+
|
38
|
+
def sinc(params = {})
|
39
|
+
write Statement.variadic("PixelFilter", "sinc", ParameterList.from(
|
40
|
+
params,
|
41
|
+
|
42
|
+
xwidth: :float,
|
43
|
+
ywidth: :float,
|
44
|
+
tau: :float,
|
45
|
+
))
|
46
|
+
end
|
47
|
+
|
48
|
+
def triangle(params = {})
|
49
|
+
write Statement.variadic("PixelFilter", "triangle", ParameterList.from(
|
50
|
+
params,
|
51
|
+
|
52
|
+
xwidth: :float,
|
53
|
+
ywidth: :float,
|
54
|
+
))
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def write(statement)
|
60
|
+
@builder.write(statement)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module PBRT
|
2
|
+
class Builder
|
3
|
+
class Sampler
|
4
|
+
def initialize(builder)
|
5
|
+
@builder = builder
|
6
|
+
end
|
7
|
+
|
8
|
+
def o2sequence(params = {})
|
9
|
+
write Statement.variadic("Sampler", "02sequence", ParameterList.from(
|
10
|
+
params,
|
11
|
+
pixelsamples: :integer,
|
12
|
+
))
|
13
|
+
end
|
14
|
+
|
15
|
+
def halton(params = {})
|
16
|
+
write Statement.variadic("Sampler", "halton", ParameterList.from(
|
17
|
+
params,
|
18
|
+
pixelsamples: :integer,
|
19
|
+
))
|
20
|
+
end
|
21
|
+
|
22
|
+
def maxmindist(params = {})
|
23
|
+
write Statement.variadic("Sampler", "maxmindist", ParameterList.from(
|
24
|
+
params,
|
25
|
+
pixelsamples: :integer,
|
26
|
+
))
|
27
|
+
end
|
28
|
+
|
29
|
+
def random(params = {})
|
30
|
+
write Statement.variadic("Sampler", "random", ParameterList.from(
|
31
|
+
params,
|
32
|
+
pixelsamples: :integer,
|
33
|
+
))
|
34
|
+
end
|
35
|
+
|
36
|
+
def sobol(params = {})
|
37
|
+
write Statement.variadic("Sampler", "sobol", ParameterList.from(
|
38
|
+
params,
|
39
|
+
pixelsamples: :integer,
|
40
|
+
))
|
41
|
+
end
|
42
|
+
|
43
|
+
def stratified(params = {})
|
44
|
+
write Statement.variadic("Sampler", "stratified", ParameterList.from(
|
45
|
+
params,
|
46
|
+
|
47
|
+
jitter: :bool,
|
48
|
+
xsamples: :integer,
|
49
|
+
ysamples: :integer,
|
50
|
+
))
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def write(statement)
|
56
|
+
@builder.write(statement)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
module PBRT
|
2
|
+
class Builder
|
3
|
+
class Shape
|
4
|
+
def initialize(builder)
|
5
|
+
@builder = builder
|
6
|
+
end
|
7
|
+
|
8
|
+
def cone(params = {})
|
9
|
+
write Statement.variadic("Shape", "cone", ParameterList.from(
|
10
|
+
params,
|
11
|
+
|
12
|
+
allow_material_overrides: true,
|
13
|
+
radius: :float,
|
14
|
+
height: :float,
|
15
|
+
phimax: :float,
|
16
|
+
))
|
17
|
+
end
|
18
|
+
|
19
|
+
def curve(params = {})
|
20
|
+
write Statement.variadic("Shape", "curve", ParameterList.from(
|
21
|
+
params,
|
22
|
+
|
23
|
+
allow_material_overrides: true,
|
24
|
+
P: :point3,
|
25
|
+
basis: :string,
|
26
|
+
degree: :integer,
|
27
|
+
type: :string,
|
28
|
+
N: :normal3,
|
29
|
+
width: :float,
|
30
|
+
width0: :float,
|
31
|
+
width1: :float,
|
32
|
+
splitdepth: :integer,
|
33
|
+
))
|
34
|
+
end
|
35
|
+
|
36
|
+
def cylinder(params = {})
|
37
|
+
write Statement.variadic("Shape", "cylinder", ParameterList.from(
|
38
|
+
params,
|
39
|
+
|
40
|
+
allow_material_overrides: true,
|
41
|
+
radius: :float,
|
42
|
+
zmin: :float,
|
43
|
+
zmax: :float,
|
44
|
+
phimax: :float,
|
45
|
+
))
|
46
|
+
end
|
47
|
+
|
48
|
+
def disk(params = {})
|
49
|
+
write Statement.variadic("Shape", "disk", ParameterList.from(
|
50
|
+
params,
|
51
|
+
|
52
|
+
allow_material_overrides: true,
|
53
|
+
height: :float,
|
54
|
+
radius: :float,
|
55
|
+
innerradius: :float,
|
56
|
+
phimax: :float,
|
57
|
+
))
|
58
|
+
end
|
59
|
+
|
60
|
+
def hyperboloid(params = {})
|
61
|
+
write Statement.variadic("Shape", "hyperboloid", ParameterList.from(
|
62
|
+
params,
|
63
|
+
|
64
|
+
allow_material_overrides: true,
|
65
|
+
p1: :point3,
|
66
|
+
p2: :point3,
|
67
|
+
phimax: :float,
|
68
|
+
))
|
69
|
+
end
|
70
|
+
|
71
|
+
def paraboloid(params = {})
|
72
|
+
write Statement.variadic("Shape", "paraboloid", ParameterList.from(
|
73
|
+
params,
|
74
|
+
|
75
|
+
allow_material_overrides: true,
|
76
|
+
radius: :float,
|
77
|
+
zmin: :float,
|
78
|
+
zmax: :float,
|
79
|
+
phimax: :float,
|
80
|
+
))
|
81
|
+
end
|
82
|
+
|
83
|
+
def sphere(params = {})
|
84
|
+
write Statement.variadic("Shape", "sphere", ParameterList.from(
|
85
|
+
params,
|
86
|
+
|
87
|
+
allow_material_overrides: true,
|
88
|
+
radius: :float,
|
89
|
+
zmin: :float,
|
90
|
+
zmax: :float,
|
91
|
+
phimax: :float,
|
92
|
+
))
|
93
|
+
end
|
94
|
+
|
95
|
+
def trianglemesh(params = {})
|
96
|
+
write Statement.variadic("Shape", "trianglemesh", ParameterList.from(
|
97
|
+
params,
|
98
|
+
|
99
|
+
allow_material_overrides: true,
|
100
|
+
indices: :integer,
|
101
|
+
P: :point3,
|
102
|
+
N: :normal3,
|
103
|
+
S: :vector3,
|
104
|
+
uv: :float,
|
105
|
+
alpha: :float_texture,
|
106
|
+
shadowalpha: :float_texture,
|
107
|
+
st: :float,
|
108
|
+
))
|
109
|
+
end
|
110
|
+
|
111
|
+
def heightfield(params = {})
|
112
|
+
write Statement.variadic("Shape", "heightfield", ParameterList.from(
|
113
|
+
params,
|
114
|
+
|
115
|
+
allow_material_overrides: true,
|
116
|
+
nu: :integer,
|
117
|
+
nv: :integer,
|
118
|
+
Pz: :float,
|
119
|
+
))
|
120
|
+
end
|
121
|
+
|
122
|
+
def loopsubdiv(params = {})
|
123
|
+
write Statement.variadic("Shape", "loopsubdiv", ParameterList.from(
|
124
|
+
params,
|
125
|
+
|
126
|
+
allow_material_overrides: true,
|
127
|
+
levels: :integer,
|
128
|
+
indices: :integer,
|
129
|
+
P: :point3,
|
130
|
+
))
|
131
|
+
end
|
132
|
+
|
133
|
+
def nurbs(params = {})
|
134
|
+
write Statement.variadic("Shape", "nurbs", ParameterList.from(
|
135
|
+
params,
|
136
|
+
|
137
|
+
allow_material_overrides: true,
|
138
|
+
nu: :integer,
|
139
|
+
nv: :integer,
|
140
|
+
uorder: :integer,
|
141
|
+
vorder: :integer,
|
142
|
+
uknots: :float,
|
143
|
+
vknots: :float,
|
144
|
+
u0: :float,
|
145
|
+
v0: :float,
|
146
|
+
u1: :float,
|
147
|
+
v1: :float,
|
148
|
+
P: :point3,
|
149
|
+
Pw: :float,
|
150
|
+
))
|
151
|
+
end
|
152
|
+
|
153
|
+
def plymesh(params = {})
|
154
|
+
write Statement.variadic("Shape", "plymesh", ParameterList.from(
|
155
|
+
params,
|
156
|
+
|
157
|
+
allow_material_overrides: true,
|
158
|
+
filename: :string,
|
159
|
+
alpha: :float_texture,
|
160
|
+
shadowalpha: :float_texture,
|
161
|
+
))
|
162
|
+
end
|
163
|
+
|
164
|
+
private
|
165
|
+
|
166
|
+
def write(statement)
|
167
|
+
@builder.write(statement)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
module PBRT
|
2
|
+
class Builder
|
3
|
+
class Texture
|
4
|
+
def initialize(builder, name, type)
|
5
|
+
@builder = builder
|
6
|
+
@directive = %(Texture "#{name}" "#{type}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def bilerp(params = {})
|
10
|
+
write Statement.variadic(@directive, "bilerp", ParameterList.from(
|
11
|
+
params,
|
12
|
+
|
13
|
+
mapping: :string,
|
14
|
+
uscale: :float,
|
15
|
+
vscale: :float,
|
16
|
+
udelta: :float,
|
17
|
+
vdelta: :float,
|
18
|
+
v1: :vector3,
|
19
|
+
v2: :vector3,
|
20
|
+
v00: :texture,
|
21
|
+
v01: :texture,
|
22
|
+
v10: :texture,
|
23
|
+
v11: :texture,
|
24
|
+
))
|
25
|
+
end
|
26
|
+
|
27
|
+
def checkerboard(params = {})
|
28
|
+
write Statement.variadic(@directive, "checkerboard", ParameterList.from(
|
29
|
+
params,
|
30
|
+
|
31
|
+
mapping: :string,
|
32
|
+
uscale: :float,
|
33
|
+
vscale: :float,
|
34
|
+
udelta: :float,
|
35
|
+
vdelta: :float,
|
36
|
+
v1: :vector3,
|
37
|
+
v2: :vector3,
|
38
|
+
dimension: :integer,
|
39
|
+
tex1: :texture,
|
40
|
+
tex2: :texture,
|
41
|
+
aamode: :string,
|
42
|
+
))
|
43
|
+
end
|
44
|
+
|
45
|
+
def constant(params = {})
|
46
|
+
write Statement.variadic(@directive, "constant", ParameterList.from(
|
47
|
+
params,
|
48
|
+
|
49
|
+
value: :texture,
|
50
|
+
foo: :texture,
|
51
|
+
))
|
52
|
+
end
|
53
|
+
|
54
|
+
def dots(params = {})
|
55
|
+
write Statement.variadic(@directive, "dots", ParameterList.from(
|
56
|
+
params,
|
57
|
+
|
58
|
+
mapping: :string,
|
59
|
+
uscale: :float,
|
60
|
+
vscale: :float,
|
61
|
+
udelta: :float,
|
62
|
+
vdelta: :float,
|
63
|
+
v1: :vector3,
|
64
|
+
v2: :vector3,
|
65
|
+
inside: :texture,
|
66
|
+
outside: :texture,
|
67
|
+
))
|
68
|
+
end
|
69
|
+
|
70
|
+
def fbm(params = {})
|
71
|
+
write Statement.variadic(@directive, "fbm", ParameterList.from(
|
72
|
+
params,
|
73
|
+
|
74
|
+
octaves: :integer,
|
75
|
+
roughness: :float,
|
76
|
+
))
|
77
|
+
end
|
78
|
+
|
79
|
+
def imagemap(params = {})
|
80
|
+
write Statement.variadic(@directive, "imagemap", ParameterList.from(
|
81
|
+
params,
|
82
|
+
|
83
|
+
mapping: :string,
|
84
|
+
uscale: :float,
|
85
|
+
vscale: :float,
|
86
|
+
udelta: :float,
|
87
|
+
vdelta: :float,
|
88
|
+
v1: :vector3,
|
89
|
+
v2: :vector3,
|
90
|
+
filename: :string,
|
91
|
+
wrap: :string,
|
92
|
+
maxanisotropy: :float,
|
93
|
+
trilinear: :bool,
|
94
|
+
scale: :float,
|
95
|
+
gamma: :bool,
|
96
|
+
))
|
97
|
+
end
|
98
|
+
|
99
|
+
def marble(params = {})
|
100
|
+
write Statement.variadic(@directive, "marble", ParameterList.from(
|
101
|
+
params,
|
102
|
+
|
103
|
+
octaves: :integer,
|
104
|
+
roughness: :float,
|
105
|
+
scale: :float,
|
106
|
+
variation: :float,
|
107
|
+
))
|
108
|
+
end
|
109
|
+
|
110
|
+
def mix(params = {})
|
111
|
+
write Statement.variadic(@directive, "mix", ParameterList.from(
|
112
|
+
params,
|
113
|
+
|
114
|
+
tex1: :texture,
|
115
|
+
tex2: :texture,
|
116
|
+
amount: :float_texture,
|
117
|
+
))
|
118
|
+
end
|
119
|
+
|
120
|
+
def scale(params = {})
|
121
|
+
write Statement.variadic(@directive, "scale", ParameterList.from(
|
122
|
+
params,
|
123
|
+
|
124
|
+
tex1: :texture,
|
125
|
+
tex2: :texture,
|
126
|
+
))
|
127
|
+
end
|
128
|
+
|
129
|
+
def uv(params = {})
|
130
|
+
write Statement.variadic(@directive, "uv", ParameterList.from(
|
131
|
+
params,
|
132
|
+
|
133
|
+
mapping: :string,
|
134
|
+
uscale: :float,
|
135
|
+
vscale: :float,
|
136
|
+
udelta: :float,
|
137
|
+
vdelta: :float,
|
138
|
+
v1: :vector3,
|
139
|
+
v2: :vector3,
|
140
|
+
))
|
141
|
+
end
|
142
|
+
|
143
|
+
def windy(params = {})
|
144
|
+
write Statement.variadic(@directive, "windy", ParameterList.from(
|
145
|
+
params,
|
146
|
+
|
147
|
+
mapping: :string,
|
148
|
+
))
|
149
|
+
end
|
150
|
+
|
151
|
+
def wrinkled(params = {})
|
152
|
+
write Statement.variadic(@directive, "wrinkled", ParameterList.from(
|
153
|
+
params,
|
154
|
+
|
155
|
+
octaves: :integer,
|
156
|
+
roughness: :float,
|
157
|
+
))
|
158
|
+
end
|
159
|
+
|
160
|
+
private
|
161
|
+
|
162
|
+
def write(statement)
|
163
|
+
@builder.write(statement)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|