Class texture_t

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class texture_t : public wt::scene::scene_element_t

Generic texture interface.

Subclassed by wt::texture::bitmap_t, wt::texture::checkerboard_t, wt::texture::constant_t, wt::texture::function_t, wt::texture::mix_t, wt::texture::scale_t, wt::texture::transform_t

Public Functions

inline texture_t(std::string id)
texture_t(texture_t&&) = default
virtual ~texture_t() noexcept = default
inline virtual bool needs_interaction_footprint() const noexcept

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

virtual vec2_t resolution() const noexcept = 0

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.

virtual std::shared_ptr<spectrum::spectrum_real_t> mean_spectrum() const noexcept = 0

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

virtual std::optional<f_t> mean_value(wavenumber_t k) const noexcept = 0

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

virtual vec4_t get_RGBA(const texture_query_t &query) const noexcept = 0

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

Returns:

RGB triplet and alpha (if any).

virtual vec2_t f(const texture_query_t &query) const noexcept = 0

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

Returns:

Spectral luminance value and alpha (if any) pair.

Public Static Functions

static inline constexpr std::string scene_element_class() noexcept
static std::shared_ptr<texture_t> load(std::string id, scene::loader::loader_t *loader, const scene::loader::node_t &node, const wt::wt_context_t &context)