NAP
Public Member Functions | List of all members
TypedUniformValueArrayInstance< T > Class Template Reference

#include <uniforminstance.h>

Public Member Functions

 TypedUniformValueArrayInstance (const ShaderVariableValueArrayDeclaration &declaration)
 
void set (const TypedUniformValueArray< T > &resource)
 
void setValues (const std::vector< T > &values)
 
void setValue (T value, int index)
 
virtual void setDefault () override
 
int getNumElements () const
 
std::vector< T > & getValues ()
 
virtual void push (uint8 *uniformBuffer) const override
 
T & operator[] (size_t index)
 
- Public Member Functions inherited from UniformValueArrayInstance
 UniformValueArrayInstance (const ShaderVariableValueArrayDeclaration &declaration)
 
virtual const ShaderVariableDeclarationgetDeclaration () const override
 
int getMaxNumElements () const
 
- Public Member Functions inherited from UniformInstance
virtual ~UniformInstance ()=default
 

Additional Inherited Members

- Protected Attributes inherited from UniformValueArrayInstance
const ShaderVariableValueArrayDeclarationmDeclaration
 

Description

template<typename T>
class nap::TypedUniformValueArrayInstance< T >

Specific type of uniform value array instance, for example: std::vector<float> -> TypedUniformValueArrayInstance<float>. All supported types are defined below for easier readability.

Inheritance diagram for TypedUniformValueArrayInstance< T >:
[legend]
Collaboration diagram for TypedUniformValueArrayInstance< T >:
[legend]

Constructor & Destructor Documentation

◆ TypedUniformValueArrayInstance()

Member Function Documentation

◆ getNumElements()

int getNumElements ( ) const
Returns
total number of elements in array

◆ getValues()

std::vector<T>& getValues ( )
Returns
entire array as a reference

◆ operator[]()

T& operator[] ( size_t  index)

Array subscript operator, returns a specific value in the array as a reference, making the following possible: mUniformArray[0] = 12;

Returns
a specific value in the array as a reference.

◆ push()

void push ( uint8 uniformBuffer) const
overridevirtual

Pushes the data to the 'Shader'

Parameters
uniformBufferthe buffer to copy the array into.

Implements UniformLeafInstance.

◆ set()

void set ( const TypedUniformValueArray< T > &  resource)

Updates the uniform value from a resource, data is not pushed immediately.

Parameters
resourceresource to copy data from.

◆ setDefault()

virtual void setDefault ( )
overridevirtual

Resize based on shader declaration.

Implements UniformValueArrayInstance.

◆ setValue()

void setValue ( value,
int  index 
)

Updates a single uniform value in the array, data is not pushed immediately. Note that the given index must be =< than length declared in shader.

Parameters
valuethe value to set
indexthe index in the array

◆ setValues()

void setValues ( const std::vector< T > &  values)

Updates the uniform value, data is not pushed immediately. Note that the length of the given values must be =< than length declared in shader.

Parameters
valuesnew list of values