NAP
Public Member Functions | List of all members
Sampler2DInstance Class Reference

#include <samplerinstance.h>

Public Member Functions

 Sampler2DInstance (RenderService &renderService, const SamplerDeclaration &declaration, const Sampler2D *sampler2D, const SamplerChangedCallback &samplerChangedCallback)
 
void setTexture (Texture2D &texture)
 
bool hasTexture () const
 
const Texture2DgetTexture () const
 
- Public Member Functions inherited from SamplerInstance
 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
 

Additional Inherited Members

- Protected Member Functions inherited from SamplerInstance
void raiseChanged (int index=0)
 
- Protected Attributes inherited from SamplerInstance
RenderServicemRenderService = nullptr
 
VkSampler mVulkanSampler = VK_NULL_HANDLE
 
const SamplermSampler = nullptr
 
const SamplerDeclarationmDeclaration = nullptr
 
SamplerChangedCallback mSamplerChangedCallback
 

Description

2D sampler instance. Binds a single 2D texture to a shader. The texture can be changed at runtime.

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

Constructor & Destructor Documentation

◆ Sampler2DInstance()

Sampler2DInstance ( RenderService renderService,
const SamplerDeclaration declaration,
const Sampler2D sampler2D,
const SamplerChangedCallback samplerChangedCallback 
)

Constructs the instance based on the shader declaration and resource.

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

Member Function Documentation

◆ getTexture()

const Texture2D& getTexture ( ) const
Returns
currently bound texture.

◆ hasTexture()

bool hasTexture ( ) const
Returns
if a texture is bound to the 2D sampler.

◆ setTexture()

void setTexture ( Texture2D texture)

Binds a texture to the 2D sampler.

Parameters
texturethe new texture to bind