tonemapping operator¶
Tonemap operators apply a postprocessing map, such as gamma correction, to the final film output. Several builtin operators are available, or an arbitrary user-supplied function can be used.
-
class tonemap_t : public wt::scene::scene_element_t
Tonemap operators apply a postprocessing map, such as gamma correction, to the final film output. See
tonemap_e
andtonemap_mode_e
.Public Functions
-
tonemap_t(std::string id, tonemap_mode_e mode, tonemap_e func, tinycolormap::ColormapType colourmap, std::optional<compiled_math_expression_t> user_func, const f_t gamma, const range_t<> &db_range)
-
inline tonemap_t(std::string id)
-
inline auto get_tonemapping_mode() const noexcept
Returns the tonemapping mode.
-
inline auto get_tonemapping_op() const noexcept
Returns the tonemapping operator.
-
inline bitmap::colour_encoding_t get_colour_encoding() const noexcept
Returns the colour encoding of a tonemapped result. Returns
linear
encoding forlinear
andfunction
tonemapping operators, otherwise returnssRGB
encoding.
-
inline auto get_gamma() const noexcept
Returns the tonemapping operator’s gamma. Only relevant to
tonemap_e::gamma
operators.
-
inline auto get_dB_range() const noexcept
Returns the tonemapping operator’s dB range. Only relevant to
tonemap_e::dB
operators.
-
inline const auto &get_colourmap_name() const noexcept
Returns the name of the colourmap. Only relevant when a colour-mapping mode is in use.
-
inline auto operator()(f_t value) const noexcept
Applies the tonemapping operator to a scalar value.
-
inline auto operator()(vec3_t value) const noexcept
Applies the tonemapping operator to an RGB triplet.
-
template<FloatingPoint Fp>
inline auto operator()(const bitmap::bitmap_t<Fp> &bmp) const Applies the tonemapping operator to a bitmap.
bmp
must be a single channel or RGB image, with its components implicitly convertible tof_t
floating points.
-
virtual scene::element::info_t description() const override
Public Static Functions
-
static inline constexpr std::string scene_element_class() noexcept
-
static inline std::unique_ptr<tonemap_t> create_linear(std::string id, tonemap_mode_e mode = tonemap_mode_e::normal, tinycolormap::ColormapType colourmap = default_colourmap) noexcept
-
static inline std::unique_ptr<tonemap_t> create_gamma(std::string id, f_t gamma, tonemap_mode_e mode = tonemap_mode_e::normal, tinycolormap::ColormapType colourmap = default_colourmap) noexcept
-
static inline std::unique_ptr<tonemap_t> create_sRGB(std::string id, tonemap_mode_e mode = tonemap_mode_e::normal, tinycolormap::ColormapType colourmap = default_colourmap) noexcept
-
static inline std::unique_ptr<tonemap_t> create_dB(std::string id, const range_t<> &db_range, tinycolormap::ColormapType colourmap) noexcept
-
static inline std::unique_ptr<tonemap_t> create_function(std::string id, compiled_math_expression_t func, tonemap_mode_e mode = tonemap_mode_e::normal, tinycolormap::ColormapType colourmap = default_colourmap) noexcept
-
static std::unique_ptr<tonemap_t> load(std::string id, scene::loader::loader_t *loader, const scene::loader::node_t &node, const wt::wt_context_t &context)
Public Static Attributes
-
static constexpr auto default_colourmap = tinycolormap::ColormapType::Magma
-
tonemap_t(std::string id, tonemap_mode_e mode, tonemap_e func, tinycolormap::ColormapType colourmap, std::optional<compiled_math_expression_t> user_func, const f_t gamma, const range_t<> &db_range)