9#ifndef AVARA3D_VISUAL_MATERIAL_TEXTURE_H
10#define AVARA3D_VISUAL_MATERIAL_TEXTURE_H
18#include "a3d/util/Bitmask.h"
19#include "a3d/visual/material/Sampler.h"
38 using Contents = std::variant<std::monostate, std::shared_ptr<Image>, std::shared_ptr<CubeImage>>;
51 const std::shared_ptr<Sampler>&
sampler = std::make_shared<Sampler>(),
85 enum class DirtyMask : uint32_t {
94 TextureId id() const noexcept;
96 DirtyMask dirtyMask() const;
97 void dirtyMask(DirtyMask mask);
103 std::shared_ptr<
Sampler> _sampler;
105 unsigned _mappingChannel;
106 DirtyMask _dirtyMask;
109 namespace util::bitmask {
112 struct enable_ops<
Texture::DirtyMask> : std::true_type {};
Describes filtering, anisotropy, and coordinate wrapping for a Texture.
Image or cubemap data together with the Sampler used to read it.
void contents(const Contents &contents)
Sets the shared image or cubemap contents.
Texture(const Contents &contents, const std::shared_ptr< Sampler > &sampler=std::make_shared< Sampler >(), unsigned mappingChannel=0)
Creates a Texture with shared contents, sampler, and mapping channel.
void sampler(const std::shared_ptr< Sampler > &sampler)
Sets the shared Sampler; nullptr removes the explicit Sampler.
std::shared_ptr< Sampler > sampler() const
Returns the shared Sampler, or nullptr if none is assigned.
const Contents & contents() const
Returns the shared image or cubemap contents.
std::variant< std::monostate, std::shared_ptr< Image >, std::shared_ptr< CubeImage > > Contents
Texture contents: empty, a 2D Image, or a CubeImage.
unsigned mappingChannel() const
Returns the stored texture-coordinate mapping channel.
void mappingChannel(unsigned channel)
Sets the stored texture-coordinate mapping channel.
Texture()
Creates an empty Texture with no contents or Sampler and mapping channel 0.