Template Class quantity_t

Inheritance Relationships

Base Type

Class Documentation

template<Quantity Q>
class quantity_t : public wt::scene::scene_element_t

Simple wrapper around texture_t that scales the queried texture value by a scalar quantity. Useful when textures with physical units are required. This element should only be nested within other elements.

Public Functions

inline quantity_t(std::string id, std::shared_ptr<texture_t> tex, Q q = f_t(1) * Q::unit)
quantity_t(quantity_t&&) = default
quantity_t(const quantity_t&) = default
inline bool needs_interaction_footprint() const noexcept

Returns TRUE for textures that make use of the surface interaction footprint data.

inline vec2_t resolution() const noexcept

Returns texture resolution represented via \( \frac{\text{texels}}{\vec{uv}} \). May return an approximation. Can be infinite, e.g., for analytic textures. Can be 1, for constant textures.

inline bool is_constant() const noexcept

Returns TRUE for textures that are constant, i.e. admit a resolution() of exactly 1.

inline std::shared_ptr<spectrum::spectrum_real_t> mean_spectrum() const noexcept

Average spectrum of the texture. Returns nullptr when an average spectrum cannot be computed.

inline std::optional<Q> mean_value(wavenumber_t k) const noexcept

Average value of the texture. Returns std::nullopt when an average value cannot be computed.

inline qvec4<Q> get_RGBA(const texture_query_t &query) const noexcept

Samples the texture. Returns filtered RGBA data, without spectral upsampling. Ignores query.k. Only relevant for some textures.

inline auto f(const texture_query_t &query) const noexcept

Samples the texture. Returns spectrally upsampled (to wavenumber query.k) result.

Returns:

Spectral luminance value and alpha (if any) pair.

inline 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<quantity_t> load(std::string id, scene::loader::loader_t *loader, const scene::loader::node_t &node, const wt::wt_context_t &context)