Avara3D 0.2.0
C++ API reference
a3d::Texture Class Reference

Image or cubemap data together with the Sampler used to read it. More...

#include <a3d/visual/material/Texture.h>

Public Types

using Contents = std::variant< std::monostate, std::shared_ptr< Image >, std::shared_ptr< CubeImage > >
 Texture contents: empty, a 2D Image, or a CubeImage. More...
 

Public Member Functions

 Texture ()
 Creates an empty Texture with no contents or Sampler and mapping channel 0. More...
 
 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. More...
 
std::shared_ptr< Samplersampler () const
 Returns the shared Sampler, or nullptr if none is assigned. More...
 
void sampler (const std::shared_ptr< Sampler > &sampler)
 Sets the shared Sampler; nullptr removes the explicit Sampler. More...
 
const Contentscontents () const
 Returns the shared image or cubemap contents. More...
 
void contents (const Contents &contents)
 Sets the shared image or cubemap contents. More...
 
unsigned mappingChannel () const
 Returns the stored texture-coordinate mapping channel. More...
 
void mappingChannel (unsigned channel)
 Sets the stored texture-coordinate mapping channel. More...
 

Detailed Description

Image or cubemap data together with the Sampler used to read it.

Texture contents and Sampler are held with shared ownership. Copying a Texture therefore shares the referenced Image or CubeImage and Sampler.

Definition at line 32 of file Texture.h.

Member Typedef Documentation

◆ Contents

using a3d::Texture::Contents = std::variant<std::monostate, std::shared_ptr<Image>, std::shared_ptr<CubeImage> >

Texture contents: empty, a 2D Image, or a CubeImage.

Definition at line 38 of file Texture.h.

Constructor & Destructor Documentation

◆ Texture() [1/2]

a3d::Texture::Texture ( )

Creates an empty Texture with no contents or Sampler and mapping channel 0.

◆ Texture() [2/2]

a3d::Texture::Texture ( const Contents contents,
const std::shared_ptr< Sampler > &  sampler = std::make_shared< Sampler >(),
unsigned  mappingChannel = 0 
)
explicit

Creates a Texture with shared contents, sampler, and mapping channel.

Omitting sampler creates a new default Sampler for the Texture.

Member Function Documentation

◆ contents() [1/2]

const Contents & a3d::Texture::contents ( ) const

Returns the shared image or cubemap contents.

◆ contents() [2/2]

void a3d::Texture::contents ( const Contents contents)

Sets the shared image or cubemap contents.

◆ mappingChannel() [1/2]

unsigned a3d::Texture::mappingChannel ( ) const

Returns the stored texture-coordinate mapping channel.

The current renderer does not consume this value.

◆ mappingChannel() [2/2]

void a3d::Texture::mappingChannel ( unsigned  channel)

Sets the stored texture-coordinate mapping channel.

The current renderer does not consume this value.

◆ sampler() [1/2]

std::shared_ptr< Sampler > a3d::Texture::sampler ( ) const

Returns the shared Sampler, or nullptr if none is assigned.

◆ sampler() [2/2]

void a3d::Texture::sampler ( const std::shared_ptr< Sampler > &  sampler)

Sets the shared Sampler; nullptr removes the explicit Sampler.


The documentation for this class was generated from the following file: