Kanzi 4.0.0-beta2
kanzi::Sampler Class Reference

Sampler provides the sampling parameters used to sampling textures. More...

#include <kanzi/core.ui/graphics2d/sampler.hpp>

Classes

struct  CreateInfo
 Sampler create info structure. More...
 

Public Types

enum  AddressingMode {
  AddressingModeWrap , AddressingModeMirror , AddressingModeClamp , AddressingModeMirrorOnce ,
  AddressingModeClampBorder
}
 Addressing mode. More...
 
enum  Filter { FilterNearest , FilterLinear }
 Filter mode. More...
 
enum  MipmapMode { MipmapModeBase , MipmapModeNearest , MipmapModeLinear }
 Mipmap mode. More...
 

Public Member Functions

constexpr AddressingMode getAddressingMode () const
 Gets the sampler addressing mode.
 
constexpr float getAnisotropy () const
 Gets the sampler anisotropy.
 
CreateInfo getCreateInfo () const
 Gets the create info that was used to create this sampler.
 
constexpr GraphicsCompareFunction getDepthCompareFunction () const
 Gets the depth compare function.
 
gfx::SamplerHandleGuard getHandle () const
 Gets the Kanzi graphics handle.
 
constexpr Filter getMagnificationFilter () const
 Gets the sampler magnification filter.
 
constexpr float getMaxLod () const
 Gets the maximum mipmap LoD level.
 
constexpr Filter getMinificationFilter () const
 Gets the sampler minification filter.
 
constexpr float getMinLod () const
 Gets the minimum mipmap LoD level.
 
constexpr float getMipLodBias () const
 Gets the mipmap LoD bias.
 
constexpr MipmapMode getMipmapMode () const
 Gets the sampler mipmap mode.
 
const string & getName () const
 Gets the name of the sampler.
 
void initializeSamplerHandle (Renderer &renderer)
 Creates the sampler handle.
 
void invalidate ()
 Invalidates the sampler.
 
Sampleroperator= (const Sampler &) KZ_DELETED_FUNCTION
 Deleted copy operator.
 
void previewPatch (Renderer &renderer, const CreateInfo &createInfo)
 Patch the sampler from given create info structure.
 
 Sampler (const Sampler &) KZ_DELETED_FUNCTION
 Deleted copy constructor.
 
 Sampler (Renderer &renderer, const CreateInfo &createInfo, string_view name)
 Construct from create information.
 

Protected Attributes

CreateInfo m_createInfo
 Create info containing all sampler settings.
 
gfx::SamplerHandleGuard m_handle
 Sampler handle.
 
string m_name
 Sampler name.
 

Friends

void swap (Sampler &left, Sampler &right)
 Swap implementation.
 
class Texture
 

Detailed Description

Sampler provides the sampling parameters used to sampling textures.

This includes for example minification and magnification filters, mipmap mode, and texture addressing mode for textures.

Since
Kanzi 4.0.0 removed the m_addressingMode, m_anisotropy, m_depthCompareFunction, m_magnificationFilter, m_maxLod, m_minificationFilter, m_minLod, m_mipLodBias and m_mipmapMode fields.

Member Enumeration Documentation

◆ Filter

Filter mode.

Enumerator
FilterNearest 

When sampling texture, select nearest texel.

FilterLinear 

When sampling texture, linearly interpolate color mixing 4 nearest texels.

◆ AddressingMode

Addressing mode.

Enumerator
AddressingModeWrap 

Wrap (Open GL ES 2 compatible)

AddressingModeMirror 

Mirror (Open GL ES 2 compatible)

AddressingModeClamp 

Clamp (Open GL ES 2 compatible)

AddressingModeMirrorOnce 

Mirror once (requires extension)

AddressingModeClampBorder 

Clamp to border.

◆ MipmapMode

Mipmap mode.

Enumerator
MipmapModeBase 

When sampling texture, use only base level image, no mipmap images are used/needed.

MipmapModeNearest 

When sampling texture, pick one image, the nearest mipmap level, mipmap images are needed.

MipmapModeLinear 

When sampling texture, pick two nearest mipmap level images, mipmap images are needed.

Constructor & Destructor Documentation

◆ Sampler() [1/2]

kanzi::Sampler::Sampler ( Renderer & renderer,
const CreateInfo & createInfo,
string_view name )
explicit

Construct from create information.

Parameters
rendererRenderer to use for creating the handle.
createInfoCreate info containing sampler settings.
nameSampler name.
Since
Kanzi 4.0.0 added the renderer and name parameters.

◆ Sampler() [2/2]

kanzi::Sampler::Sampler ( const Sampler & )

Deleted copy constructor.

Member Function Documentation

◆ operator=()

Sampler & kanzi::Sampler::operator= ( const Sampler & )

Deleted copy operator.

◆ getCreateInfo()

CreateInfo kanzi::Sampler::getCreateInfo ( ) const
inline

Gets the create info that was used to create this sampler.

Returns
Copy of the sampler create info structure.
Since
Kanzi 4.0.0

◆ getName()

const string & kanzi::Sampler::getName ( ) const
inline

Gets the name of the sampler.

Returns
Reference to the name.

◆ getMipmapMode()

constexpr MipmapMode kanzi::Sampler::getMipmapMode ( ) const
inlineconstexpr

Gets the sampler mipmap mode.

Returns
Mipmap mode.

◆ getMinificationFilter()

constexpr Filter kanzi::Sampler::getMinificationFilter ( ) const
inlineconstexpr

Gets the sampler minification filter.

Returns
Minification filter.

◆ getMagnificationFilter()

constexpr Filter kanzi::Sampler::getMagnificationFilter ( ) const
inlineconstexpr

Gets the sampler magnification filter.

Returns
Magnification filter.

◆ getAddressingMode()

constexpr AddressingMode kanzi::Sampler::getAddressingMode ( ) const
inlineconstexpr

Gets the sampler addressing mode.

Returns
Addressing mode.

◆ getDepthCompareFunction()

constexpr GraphicsCompareFunction kanzi::Sampler::getDepthCompareFunction ( ) const
inlineconstexpr

Gets the depth compare function.

Returns
Depth compare function.

◆ getAnisotropy()

constexpr float kanzi::Sampler::getAnisotropy ( ) const
inlineconstexpr

Gets the sampler anisotropy.

Returns
Anisotropy level.

◆ getMipLodBias()

constexpr float kanzi::Sampler::getMipLodBias ( ) const
inlineconstexpr

Gets the mipmap LoD bias.

Returns
Mipmap LoD bias.

◆ getMinLod()

constexpr float kanzi::Sampler::getMinLod ( ) const
inlineconstexpr

Gets the minimum mipmap LoD level.

Returns
Minimum LoD level.

◆ getMaxLod()

constexpr float kanzi::Sampler::getMaxLod ( ) const
inlineconstexpr

Gets the maximum mipmap LoD level.

Returns
maximum LoD level.

◆ getHandle()

gfx::SamplerHandleGuard kanzi::Sampler::getHandle ( ) const
inline

Gets the Kanzi graphics handle.

◆ invalidate()

void kanzi::Sampler::invalidate ( )

Invalidates the sampler.

◆ previewPatch()

void kanzi::Sampler::previewPatch ( Renderer & renderer,
const CreateInfo & createInfo )

Patch the sampler from given create info structure.

Parameters
rendererRenderer to use for creating the handle.
createInfoCreate info containing sampler settings.
Since
Kanzi 4.0.0 added the renderer parameter.

◆ initializeSamplerHandle()

void kanzi::Sampler::initializeSamplerHandle ( Renderer & renderer)

Creates the sampler handle.

Parameters
rendererRenderer to use for creating the sampler.
Since
Kanzi 4.0.0

Friends And Related Symbol Documentation

◆ Texture

◆ swap

void swap ( Sampler & left,
Sampler & right )
friend

Swap implementation.

Parameters
leftLeft-hand-side operand.
rightRight-hand-side operand.

Member Data Documentation

◆ m_createInfo

CreateInfo kanzi::Sampler::m_createInfo
protected

Create info containing all sampler settings.

Since
Kanzi 4.0.0

◆ m_name

string kanzi::Sampler::m_name
protected

Sampler name.

Since
Kanzi 4.0.0

◆ m_handle

gfx::SamplerHandleGuard kanzi::Sampler::m_handle
protected

Sampler handle.

Since
Kanzi 4.0.0

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