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

#include <samplerinstance.h>

Public Member Functions

 Sampler2DArrayInstance (RenderService &renderService, const SamplerDeclaration &declaration, const Sampler2DArray *sampler2DArray, const SamplerChangedCallback &samplerChangedCallback)
 
bool hasTexture (int index) const
 
const Texture2DgetTexture (int index) const
 
void setTexture (int index, Texture2D &texture)
 
rtti::ObjectPtr< Texture2D > & operator[] (size_t index)
 
- Public Member Functions inherited from SamplerArrayInstance
 SamplerArrayInstance (RenderService &renderService, const SamplerDeclaration &declaration, const Sampler *sampler, const SamplerChangedCallback &samplerChangedCallback)
 
virtual ~SamplerArrayInstance ()
 
virtual int getNumElements () 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 array instance. Binds multiple 2D textures to a shader. The array can be changed at runtime.

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

Constructor & Destructor Documentation

◆ Sampler2DArrayInstance()

Sampler2DArrayInstance ( RenderService renderService,
const SamplerDeclaration declaration,
const Sampler2DArray sampler2DArray,
const SamplerChangedCallback samplerChangedCallback 
)

Constructs the instance based on the shader declaration and resource.

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

Member Function Documentation

◆ getTexture()

const Texture2D& getTexture ( int  index) const
Parameters
indexthe index to get the texture for.
Returns
the texture at the given index

◆ hasTexture()

bool hasTexture ( int  index) const
Returns
if a texture is bound to the given index.

◆ operator[]()

rtti::ObjectPtr<Texture2D>& operator[] ( size_t  index)

Array subscript operator, returns a specific texture in the array as a reference, making the following possible: mTextures[0] = myTexture;

Returns
a specific value in the array as a reference.

◆ setTexture()

void setTexture ( int  index,
Texture2D texture 
)

Binds a texture at the given index

Parameters
indexthe index to bind the texture to
texturethe texture to bind.