tinypbrt 1.1.1
pbrt-v4 scene file parser for C11 with a header-only C++20 wrapper
Loading...
Searching...
No Matches
film.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef _TINYPBRT_FILM_HPP_
3#define _TINYPBRT_FILM_HPP_
4
6
8
11
12namespace tpbrt {
32
39 [[nodiscard]] constexpr std::string_view to_string(const film_type type) noexcept {
40 using enum film_type;
41 switch (type) {
42 case RGB: return "rgb";
43 case GBUFFER: return "gbuffer";
44 case SPECTRAL: return "spectral";
45 case MAX_NUM: return "maxnum";
46 default: return "UNKNOWN";
47 }
48 }
49
54 struct film_gbuffer_params : detail::wrapper<film_gbuffer_params, tpbrt_film_gbuffer_params_t> {
56 using wrapper::wrapper;
57
59 [[nodiscard]] constexpr coord_system_type coordinate_system() const noexcept {
60 return static_cast<coord_system_type>(_native->coordinate_system);
61 }
62
64 [[nodiscard]] constexpr auto reflect() const noexcept { return std::make_tuple(coordinate_system()); }
65 };
66
71 struct film_spectral_params : detail::wrapper<film_spectral_params, tpbrt_film_spectral_params_t> {
73 using wrapper::wrapper;
74
76 [[nodiscard]] constexpr uint_t nbuckets() const noexcept { return _native->nbuckets; }
77
79 [[nodiscard]] constexpr float_t lambda_min() const noexcept { return _native->lambda_min; }
80
82 [[nodiscard]] constexpr float_t lambda_max() const noexcept { return _native->lambda_max; }
83
85 [[nodiscard]] constexpr auto reflect() const noexcept { return std::make_tuple(nbuckets(), lambda_min(), lambda_max()); }
86 };
87
132
139 [[nodiscard]] constexpr std::string_view to_string(const film_sensor type) noexcept {
140 using enum film_sensor;
141 switch (type) {
142 case CIE_1931: return "cie1931";
143 case CANON_EOS_100D: return "canon_eos_100d";
144 case CANON_EOS_1DX_MKII: return "canon_eos_1dx_mkii";
145 case CANON_EOS_200D: return "canon_eos_200d";
146 case CANON_EOS_200D_MKII: return "canon_eos_200d_mkii";
147 case CANON_EOS_5D: return "canon_eos_5d";
148 case CANON_EOS_5D_MKII: return "canon_eos_5d_mkii";
149 case CANON_EOS_5D_MKIII: return "canon_eos_5d_mkiii";
150 case CANON_EOS_5D_MKIV: return "canon_eos_5d_mkiv";
151 case CANON_EOS_5DS: return "canon_eos_5ds";
152 case CANON_EOS_M: return "canon_eos_m";
153 case HASSELBLAD_L1D_20C: return "hasselblad_l1d_20c";
154 case NIKON_D810: return "nikon_d810";
155 case NIKON_D850: return "nikon_d850";
156 case SONY_ILCE_6400: return "sony_ilce_6400";
157 case SONY_ILCE_7M3: return "sony_ilce_7m3";
158 case SONY_ILCE_7RM3: return "sony_ilce_7rm3";
159 case SONY_ILCE_9: return "sony_ilce_9";
160 case MAX_NUM: return "maxnum";
161 default: return "UNKNOWN";
162 }
163 }
164
169 struct film : detail::wrapper<film, tpbrt_film_t>,
170 detail::with_variant<film, film_gbuffer_params, film_spectral_params> {
173
176
178 using wrapper::wrapper;
179
181 [[nodiscard]] constexpr crop_window_type crop_window() const noexcept { return _native->crop_window; }
182
184 [[nodiscard]] constexpr pixel_bounds_type pixel_bounds() const noexcept { return _native->pixel_bounds; }
185
187 [[nodiscard]] constexpr string file_name() const noexcept { return _native->file_name; }
188
190 [[nodiscard]] constexpr uint_t x_resolution() const noexcept { return _native->x_resolution; }
191
193 [[nodiscard]] constexpr uint_t y_resolution() const noexcept { return _native->y_resolution; }
194
196 [[nodiscard]] constexpr float_t diagonal() const noexcept { return _native->diagonal; }
197
199 [[nodiscard]] constexpr float_t iso() const noexcept { return _native->iso; }
200
202 [[nodiscard]] constexpr float_t white_balance() const noexcept { return _native->white_balance; }
203
205 [[nodiscard]] constexpr float_t max_component_value() const noexcept { return _native->max_component_value; }
206
208 [[nodiscard]] constexpr film_sensor sensor() const noexcept { return static_cast<film_sensor>(_native->sensor); }
209
211 [[nodiscard]] constexpr bool_t save_fp16() const noexcept { return _native->save_fp16 == True; }
212
214 [[nodiscard]] constexpr film_type type() const noexcept { return static_cast<film_type>(_native->type); }
215
217 [[nodiscard]] constexpr bool_t is_gbuffer() const noexcept { return type() == film_type::GBUFFER; }
218
220 [[nodiscard]] constexpr bool_t is_spectral() const noexcept { return type() == film_type::SPECTRAL; }
221
223 [[nodiscard]] constexpr std::optional<film_gbuffer_params> as_gbuffer() const noexcept {
224 if (!is_gbuffer()) { return std::nullopt; }
225 return _native->as.gbuffer;
226 }
227
229 [[nodiscard]] constexpr std::optional<film_spectral_params> as_spectral() const noexcept {
230 if (!is_spectral()) { return std::nullopt; }
231 return _native->as.spectral;
232 }
233
235 [[nodiscard]] constexpr variant_type to_variant() const noexcept {
236 using enum film_type;
237 switch (type()) {
238 case GBUFFER: return _native->as.gbuffer;
239 case SPECTRAL: return _native->as.spectral;
240 case MAX_NUM: [[fallthrough]];
241 default: break;
242 }
243 return std::nullopt;
244 }
245
247 [[nodiscard]] constexpr auto reflect() const noexcept {
248 return std::make_tuple(crop_window(), pixel_bounds(), file_name(), x_resolution(), y_resolution(), diagonal(), iso(),
250 }
251 };
252} // namespace tpbrt
253#endif // _TINYPBRT_FILM_HPP_
constexpr std::string_view to_string(const accelerator_type type) noexcept
Converts accelerator_type enum value to string.
Definition accelerator.hpp:39
@ MAX_NUM
Count of available accelerator types.
@ RGB
Spectrum defined as RGB value.
tpbrt_uchar_t uchar_t
Unsigned char type.
Definition fwd.hpp:34
coord_system_type
Coordinate System type.
Definition coord.hpp:21
film_type
Film value type.
Definition film.hpp:22
film_sensor
Film sensor type.
Definition film.hpp:92
@ SPECTRAL
stores a discretized spectral distribution at each pixel, in addition to RGB (for convenience when vi...
@ GBUFFER
In addition to RGB, stores multiple additional channels that encode information about the visible geo...
@ CANON_EOS_5D
Canon EOS 5D sensor.
@ CANON_EOS_5D_MKIV
Canon EOS 5D MK IV sensor.
@ SONY_ILCE_6400
Sony ILCE 6400 sensor.
@ CANON_EOS_200D
Canon EOS 200D sensor.
@ SONY_ILCE_7RM3
Sony ILCE 7RM3 sensor.
@ CANON_EOS_5D_MKIII
Canon EOS 5D MK III sensor.
@ CANON_EOS_100D
Canon EOS 100D sensor.
@ NIKON_D850
Nikon D850 sensor.
@ CANON_EOS_5D_MKII
Canon EOS 5D MK II sensor.
@ CANON_EOS_M
Canon EOS M sensor.
@ SONY_ILCE_7M3
Sony ILCE 7M3 sensor.
@ NIKON_D810
Nikon D810 sensor.
@ CANON_EOS_5DS
Canon EOS 5DS sensor.
@ HASSELBLAD_L1D_20C
Hasselblad L1D 20C sensor.
@ CANON_EOS_200D_MKII
Canon EOS 200D MK II sensor.
@ SONY_ILCE_9
Sony ILCE 9 sensor.
@ CIE_1931
The CIE 1931 spectral response curves.
@ CANON_EOS_1DX_MKII
Canon EOS 1DX MK II sensor.
@ TPBRT_FILM_SENSOR_SONY_ILCE_6400
Sony ILCE 6400 sensor.
Definition film.h:90
@ TPBRT_FILM_SENSOR_CANON_EOS_1DX_MKII
Canon EOS 1DX MK II sensor.
Definition film.h:66
@ TPBRT_FILM_SENSOR_CANON_EOS_5D_MKII
Canon EOS 5D MK II sensor.
Definition film.h:74
@ TPBRT_FILM_SENSOR_CANON_EOS_100D
Canon EOS 100D sensor.
Definition film.h:64
@ TPBRT_FILM_SENSOR_CANON_EOS_200D
Canon EOS 200D sensor.
Definition film.h:68
@ TPBRT_FILM_SENSOR_SONY_ILCE_7RM3
Sony ILCE 7RM3 sensor.
Definition film.h:94
@ TPBRT_FILM_SENSOR_CANON_EOS_200D_MKII
Canon EOS 200D MK II sensor.
Definition film.h:70
@ TPBRT_FILM_SENSOR_HASSELBLAD_L1D_20C
Hasselblad L1D 20C sensor.
Definition film.h:84
@ TPBRT_FILM_SENSOR_CANON_EOS_5D_MKIV
Canon EOS 5D MK IV sensor.
Definition film.h:78
@ TPBRT_FILM_SENSOR_SONY_ILCE_7M3
Sony ILCE 7M3 sensor.
Definition film.h:92
@ TPBRT_FILM_SENSOR_NIKON_D810
Nikon D810 sensor.
Definition film.h:86
@ TPBRT_FILM_SENSOR_CANON_EOS_M
Canon EOS M sensor.
Definition film.h:82
@ TPBRT_FILM_SENSOR_MAX_NUM
Count of available film sensor types.
Definition film.h:98
@ TPBRT_FILM_SENSOR_NIKON_D850
Nikon D850 sensor.
Definition film.h:88
@ TPBRT_FILM_SENSOR_CANON_EOS_5D_MKIII
Canon EOS 5D MK III sensor.
Definition film.h:76
@ TPBRT_FILM_SENSOR_SONY_ILCE_9
Sony ILCE 9 sensor.
Definition film.h:96
@ TPBRT_FILM_SENSOR_CANON_EOS_5D
Canon EOS 5D sensor.
Definition film.h:72
@ TPBRT_FILM_SENSOR_CIE_1931
The CIE 1931 spectral response curves.
Definition film.h:62
@ TPBRT_FILM_SENSOR_CANON_EOS_5DS
Canon EOS 5DS sensor.
Definition film.h:80
@ TPBRT_FILM_TYPE_RGB
Stores RGB images using the current color space when the Film directive is encountered.
Definition film.h:25
@ TPBRT_FILM_TYPE_GBUFFER
In addition to RGB, stores multiple additional channels that encode information about the visible geo...
Definition film.h:27
@ TPBRT_FILM_TYPE_SPECTRAL
stores a discretized spectral distribution at each pixel, in addition to RGB (for convenience when vi...
Definition film.h:29
@ TPBRT_FILM_TYPE_MAX_NUM
Count of available film types.
Definition film.h:31
tpbrt_uint_t uint_t
Unsigned int type.
Definition fwd.hpp:92
bool bool_t
Bool type.
Definition fwd.hpp:82
tpbrt_float_t float_t
Float type.
Definition fwd.hpp:97
constexpr auto True
True value.
Definition fwd.hpp:20
Definition accelerator.hpp:14
Generic C++ array view with type conversion (a non owning view on memory owned by the C library).
Definition common.hpp:448
C++ wrapper for tpbrt_film_gbuffer_params_t.
Definition film.hpp:54
constexpr auto reflect() const noexcept
Conversion to tuple.
Definition film.hpp:64
constexpr coord_system_type coordinate_system() const noexcept
Returns coordinate_system value.
Definition film.hpp:59
C++ wrapper for tpbrt_film_spectral_params_t.
Definition film.hpp:71
constexpr uint_t nbuckets() const noexcept
Returns nbuckets value.
Definition film.hpp:76
constexpr float_t lambda_max() const noexcept
Returns lambda_max value.
Definition film.hpp:82
constexpr float_t lambda_min() const noexcept
Returns lambda_min value.
Definition film.hpp:79
constexpr auto reflect() const noexcept
Conversion to tuple.
Definition film.hpp:85
C++ wrapper for tpbrt_film_t.
Definition film.hpp:170
constexpr string file_name() const noexcept
Returns file_name value.
Definition film.hpp:187
constexpr variant_type to_variant() const noexcept
Conversion to variant.
Definition film.hpp:235
constexpr pixel_bounds_type pixel_bounds() const noexcept
Returns pixel_bounds value.
Definition film.hpp:184
constexpr bool_t save_fp16() const noexcept
Returns save_fp16 value.
Definition film.hpp:211
constexpr uint_t y_resolution() const noexcept
Returns y_resolution value.
Definition film.hpp:193
constexpr std::optional< film_spectral_params > as_spectral() const noexcept
Returns film parameters as spectral.
Definition film.hpp:229
constexpr float_t white_balance() const noexcept
Returns white_balance value.
Definition film.hpp:202
constexpr bool_t is_spectral() const noexcept
Returns true if type is spectral.
Definition film.hpp:220
constexpr film_type type() const noexcept
Returns type value.
Definition film.hpp:214
constexpr auto reflect() const noexcept
Conversion to tuple.
Definition film.hpp:247
constexpr float_t diagonal() const noexcept
Returns diagonal value.
Definition film.hpp:196
constexpr bool_t is_gbuffer() const noexcept
Returns true if type is gbuffer.
Definition film.hpp:217
constexpr uint_t x_resolution() const noexcept
Returns x_resolution value.
Definition film.hpp:190
constexpr float_t iso() const noexcept
Returns iso value.
Definition film.hpp:199
constexpr std::optional< film_gbuffer_params > as_gbuffer() const noexcept
Returns film parameters as gbuffer.
Definition film.hpp:223
constexpr crop_window_type crop_window() const noexcept
Returns crop_window value.
Definition film.hpp:181
constexpr film_sensor sensor() const noexcept
Returns sensor value.
Definition film.hpp:208
constexpr float_t max_component_value() const noexcept
Returns max_component_value value.
Definition film.hpp:205