NAP
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SamplerInstance Class Reference

#include <samplerinstance.h>

Public Member Functions

 SamplerInstance (RenderService &renderService, const SamplerDeclaration &declaration, const Sampler *sampler, const SamplerChangedCallback &samplerChangedCallback)
 
virtual ~SamplerInstance ()
 
bool init (utility::ErrorState &errorState)
 
const SamplerDeclarationgetDeclaration () const
 
VkSampler getVulkanSampler () const
 

Protected Member Functions

void raiseChanged (int index=0)
 

Protected Attributes

RenderServicemRenderService = nullptr
 
VkSampler mVulkanSampler = VK_NULL_HANDLE
 
const SamplermSampler = nullptr
 
const SamplerDeclarationmDeclaration = nullptr
 
SamplerChangedCallback mSamplerChangedCallback
 

Description

Sampler instance base class. Allows for interfacing with samplers at run-time.

Inheritance diagram for SamplerInstance:
[legend]
Collaboration diagram for SamplerInstance:
[legend]

Constructor & Destructor Documentation

◆ SamplerInstance()

SamplerInstance ( RenderService renderService,
const SamplerDeclaration declaration,
const Sampler sampler,
const SamplerChangedCallback samplerChangedCallback 
)

Constructs the instance based on the shader declaration and resource.

Parameters
renderServicerender engine
declarationsampler shader declaration
samplerthe sampler resource used to create this instance.
samplerChangedCallbackcalled when the 'texture' changes.

◆ ~SamplerInstance()

virtual ~SamplerInstance ( )
virtual

Member Function Documentation

◆ getDeclaration()

const SamplerDeclaration& getDeclaration ( ) const
Returns
sampler shader declaration.

◆ getVulkanSampler()

VkSampler getVulkanSampler ( ) const
Returns
the vulkan sampler handle

◆ init()

bool init ( utility::ErrorState errorState)

Initializes the sampler.

Parameters
errorStatecontains the error if initialization fails
Returns
if initialization succeeded.

◆ raiseChanged()

void raiseChanged ( int  index = 0)
protected

Called when the texture changes.

Parameters
indextexture index, zero unless the non-initial texture in a sampler array is changed.

Member Data Documentation

◆ mDeclaration

const SamplerDeclaration* mDeclaration = nullptr
protected

◆ mRenderService

RenderService* mRenderService = nullptr
protected

◆ mSampler

const Sampler* mSampler = nullptr
protected

◆ mSamplerChangedCallback

SamplerChangedCallback mSamplerChangedCallback
protected

◆ mVulkanSampler

VkSampler mVulkanSampler = VK_NULL_HANDLE
protected