NAP
Public Types | Public Member Functions | Protected Member Functions | List of all members
UniformContainer Class Reference

#include <uniformcontainer.h>

Public Types

using UniformStructInstanceList = std::vector< std::unique_ptr< UniformStructInstance > >
 
using BufferBindingInstanceList = std::vector< std::unique_ptr< BufferBindingInstance > >
 
using SamplerInstanceList = std::vector< std::unique_ptr< SamplerInstance > >
 

Public Member Functions

 UniformContainer ()=default
 
virtual ~UniformContainer ()=default
 
 UniformContainer (const UniformContainer &)=delete
 
UniformContaineroperator= (const UniformContainer &)=delete
 
UniformStructInstancefindUniform (const std::string &name)
 
BufferBindingInstancefindBinding (const std::string &name)
 
UniformStructInstancegetUniform (const std::string &name)
 
BufferBindingInstancegetBinding (const std::string &name)
 
const SamplerInstanceListgetSamplers () const
 
const BufferBindingInstanceListgetBufferBindings () const
 
const UniformStructInstanceListgetUniformStructs () const
 
SamplerInstancefindSampler (const std::string &name) const
 

Protected Member Functions

UniformStructInstancecreateUniformRootStruct (const ShaderVariableStructDeclaration &declaration, const UniformCreatedCallback &uniformCreatedCallback)
 
BufferBindingInstanceaddBindingInstance (std::unique_ptr< BufferBindingInstance > instance)
 
SamplerInstanceaddSamplerInstance (std::unique_ptr< SamplerInstance > instance)
 

Description

Manages uniform struct and sampler instances. Every struct and sampler is tied to a shader declaration. The declaration acts as the interface to a uniform struct or sampler on a shader. Both the nap::Material and nap::MaterialInstance are a uniform container.

Inheritance diagram for UniformContainer:
[legend]

Member Typedef Documentation

◆ BufferBindingInstanceList

using BufferBindingInstanceList = std::vector<std::unique_ptr<BufferBindingInstance> >

◆ SamplerInstanceList

using SamplerInstanceList = std::vector<std::unique_ptr<SamplerInstance> >

◆ UniformStructInstanceList

using UniformStructInstanceList = std::vector<std::unique_ptr<UniformStructInstance> >

Constructor & Destructor Documentation

◆ UniformContainer() [1/2]

UniformContainer ( )
default

◆ ~UniformContainer()

virtual ~UniformContainer ( )
virtualdefault

◆ UniformContainer() [2/2]

UniformContainer ( const UniformContainer )
delete

Member Function Documentation

◆ addBindingInstance()

BufferBindingInstance& addBindingInstance ( std::unique_ptr< BufferBindingInstance instance)
protected

◆ addSamplerInstance()

SamplerInstance& addSamplerInstance ( std::unique_ptr< SamplerInstance instance)
protected

◆ createUniformRootStruct()

UniformStructInstance& createUniformRootStruct ( const ShaderVariableStructDeclaration declaration,
const UniformCreatedCallback uniformCreatedCallback 
)
protected

◆ findBinding()

BufferBindingInstance* findBinding ( const std::string &  name)

Tries to find a buffer binding instance with the given name.

Parameters
namename of the buffer binding as declared in the shader.
Returns
a buffer binding instance, nullptr if not present.

◆ findSampler()

SamplerInstance* findSampler ( const std::string &  name) const

Tries to find a sampler instance with the given name.

Parameters
namethe name of the sampler as declared in the shader.
Returns
the sampler with the given name, nullptr if not found.

◆ findUniform()

UniformStructInstance* findUniform ( const std::string &  name)

Tries to find a uniform struct instance with the given name.

Parameters
namename of the uniform struct (ubo) as declared in the shader.
Returns
a uniform struct instance (ubo), nullptr if not present.

◆ getBinding()

BufferBindingInstance& getBinding ( const std::string &  name)

Returns a buffer binding instance with the given name. The binding must exist.

Parameters
namename of the buffer binding as declared in the shader.
Returns
buffer binding instance with the given name, asserts if not present.

◆ getBufferBindings()

const BufferBindingInstanceList& getBufferBindings ( ) const
Returns
all the buffer binding instances.

◆ getSamplers()

const SamplerInstanceList& getSamplers ( ) const
Returns
all the uniforms sampler instances.

◆ getUniform()

UniformStructInstance& getUniform ( const std::string &  name)

Returns a uniform struct instance with the given name, the struct has to exist.

Parameters
namename of the uniform struct as declared in the shader.
Returns
uniform struct instance with the given name, asserts if not present.

◆ getUniformStructs()

const UniformStructInstanceList& getUniformStructs ( ) const
Returns
all the uniform root structs.

◆ operator=()

UniformContainer& operator= ( const UniformContainer )
delete