Class texture2d_t

Inheritance Relationships

Derived Type

Class Documentation

class texture2d_t

A texture is a 2D bitmap with filtering and colour encoding facilities.

Subclassed by wt::bitmap::texture2d_tmpl_t< TexelT, texfilter, layout, colour_encoding_type >

Public Functions

inline texture2d_t(texture2d_storage_t storage, texture2d_config_t config, colour_encoding_t colour_encoding) noexcept
texture2d_t(texture2d_t&&) = default
virtual ~texture2d_t() noexcept = default
virtual std::size_t component_bytes() const noexcept = 0

Returns the byte per pixel component.

virtual std::size_t bytes() const noexcept = 0

Returns the total size (in bytes) of the texture.

inline colour_encoding_t colour_encoding() const noexcept

Returns the colour encoding used for the texture. Ignored for floating-point textures.

virtual texture_filter_type_e get_tex_filter() const noexcept = 0

Returns the requested texture filter.

inline const auto pixel_layout() const noexcept

Returns the pixel layout.

inline const auto components() const noexcept

Returns the number of components per pixel.

inline vec2u32_t dimensions() const noexcept

Returns the image dimension of the texture.

inline const auto &get_storage() const noexcept
virtual vec4_t texel(vec2i32_t coord) const noexcept = 0

Access a single texel at an image coordinate.

inline vec4_t minimum_value() const noexcept

Texture minimal texel value.

inline vec4_t maximum_value() const noexcept

Texture maximum texel value.

inline vec4_t mean_value() const noexcept

Texture average texel value.

inline bool is_constant() const noexcept

Returns TRUE for textures that are constant.

virtual vec4_t filter(vec2_t uv, const vec2_t dudp, const vec2_t dvdp) const noexcept = 0

Filters the texture.

Parameters:
  • uv – ∈[0,1]² uv coordinates

  • dudp – partial derivatives of u w.r.t. sampling area

  • dvdp – partial derivatives of v w.r.t. sampling area

virtual scene::element::info_t description() const = 0

Public Static Functions

static std::unique_ptr<texture2d_t> load_from_path(const wt_context_t &ctx, const std::filesystem::path &path, const texture2d_config_t config = {}, std::optional<colour_encoding_t> colour_encoding = {})

Loads a texture from a path.

Parameters:

colour_encoding – (optional) Desired colour encoding, if not provided uses the colour encoding of the stored bitmap

Protected Functions

inline void compute_texture_data() noexcept

Protected Attributes

texture2d_storage_t storage
texture2d_config_t config
colour_encoding_t config_colour_encoding

Colour encoding for unorm/snorm textures. Ignored for floating point textures.

vec4_t min_value
vec4_t max_value
vec4_t avg_value