globjects  1.1.0.2f0c753c8647
Strict OpenGL objects wrapper.

Abstract base class for templated Uniforms. More...

#include <globjects/include/globjects/AbstractUniform.h>

Inheritance diagram for globjects::AbstractUniform:
globjects::Referenced globjects::HeapOnly globjects::Uniform< T >

Public Types

enum  BindlessImplementation { SeparateShaderObjectsARB, Legacy }
 

Public Member Functions

 AbstractUniform (gl::GLint location)
 
 AbstractUniform (const std::string &name)
 
const std::string & name () const
 
gl::GLint location () const
 
const LocationIdentityidentity () const
 
template<typename T >
Uniform< T > * as ()
 
template<typename T >
const Uniform< T > * as () const
 
- Public Member Functions inherited from globjects::Referenced
 Referenced ()
 
void ref () const
 
void unref () const
 
int refCounter () const
 
- Public Member Functions inherited from globjects::HeapOnly
 HeapOnly ()
 
void destroy () const
 

Static Public Member Functions

static void hintBindlessImplementation (const BindlessImplementation impl)
 

Protected Member Functions

virtual ~AbstractUniform ()
 
void registerProgram (Program *program)
 
void deregisterProgram (Program *program)
 
void changed ()
 
void update (const Program *program, bool invalidateLocation) const
 
virtual void updateAt (const Program *program, gl::GLint location) const =0
 
gl::GLint locationFor (const Program *program) const
 
void setValue (const Program *program, gl::GLint location, const float &value) const
 
void setValue (const Program *program, gl::GLint location, const int &value) const
 
void setValue (const Program *program, gl::GLint location, const unsigned int &value) const
 
void setValue (const Program *program, gl::GLint location, const bool &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::vec2 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::vec3 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::vec4 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::ivec2 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::ivec3 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::ivec4 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::uvec2 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::uvec3 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::uvec4 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat2 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat3 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat4 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat2x3 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat3x2 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat2x4 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat4x2 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat3x4 &value) const
 
void setValue (const Program *program, gl::GLint location, const glm::mat4x3 &value) const
 
void setValue (const Program *program, gl::GLint location, const gl::GLuint64 &value) const
 
void setValue (const Program *program, gl::GLint location, const TextureHandle &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< float > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< int > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< unsigned int > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< bool > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::vec2 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::vec3 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::vec4 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::ivec2 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::ivec3 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::ivec4 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::uvec2 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::uvec3 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::uvec4 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat2 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat3 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat4 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat2x3 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat3x2 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat2x4 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat4x2 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat3x4 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< glm::mat4x3 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< gl::GLuint64 > &value) const
 
void setValue (const Program *program, gl::GLint location, const std::vector< TextureHandle > &value) const
 
template<typename T , std::size_t Count>
void setValue (const Program *program, gl::GLint location, const std::array< T, Count > &value) const
 
- Protected Member Functions inherited from globjects::Referenced
virtual ~Referenced ()
 
- Protected Member Functions inherited from globjects::HeapOnly
virtual ~HeapOnly ()
 

Protected Attributes

LocationIdentity m_identity
 
std::set< Program * > m_programs
 
std::unordered_map< const Program *, gl::GLint > m_locations
 

Friends

class Program
 Programs (de)register themselves. More...
 

Detailed Description

Abstract base class for templated Uniforms.

Unifies the specialized Uniforms in order to be able to store them in a list or a vector.

See also
Uniform
Program

Member Enumeration Documentation

Enumerator
SeparateShaderObjectsARB 
Legacy 

Constructor & Destructor Documentation

globjects::AbstractUniform::AbstractUniform ( gl::GLint  location)
globjects::AbstractUniform::AbstractUniform ( const std::string &  name)
virtual globjects::AbstractUniform::~AbstractUniform ( )
protectedvirtual

Member Function Documentation

static void globjects::AbstractUniform::hintBindlessImplementation ( const BindlessImplementation  impl)
static
const std::string& globjects::AbstractUniform::name ( ) const
gl::GLint globjects::AbstractUniform::location ( ) const
const LocationIdentity& globjects::AbstractUniform::identity ( ) const
template<typename T >
Uniform<T>* globjects::AbstractUniform::as ( )

Simplifies the often required casting of AbstractUniforms.

Returns
a specialized Uniform of the requested type, returns a nullptr on a type mismatch
abstractUniform->as<float>()->setValue(3.142f);
template<typename T >
const Uniform<T>* globjects::AbstractUniform::as ( ) const
void globjects::AbstractUniform::registerProgram ( Program program)
protected
void globjects::AbstractUniform::deregisterProgram ( Program program)
protected
void globjects::AbstractUniform::changed ( )
protected

Iterates over all programs attached to and calls update. Should be called on every value change (i.e., in Uniform).

void globjects::AbstractUniform::update ( const Program program,
bool  invalidateLocation 
) const
protected

Sets the uniform's value on the program.

virtual void globjects::AbstractUniform::updateAt ( const Program program,
gl::GLint  location 
) const
protectedpure virtual

This function requires knowledge of the unifom's value.

Implemented in globjects::Uniform< T >.

gl::GLint globjects::AbstractUniform::locationFor ( const Program program) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const float &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const int &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const unsigned int &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const bool &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::vec2 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::vec3 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::vec4 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::ivec2 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::ivec3 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::ivec4 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::uvec2 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::uvec3 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::uvec4 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat2 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat3 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat4 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat2x3 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat3x2 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat2x4 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat4x2 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat3x4 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const glm::mat4x3 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const gl::GLuint64 &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const TextureHandle value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< float > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< int > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< unsigned int > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< bool > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::vec2 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::vec3 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::vec4 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::ivec2 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::ivec3 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::ivec4 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::uvec2 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::uvec3 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::uvec4 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat2 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat3 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat4 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat2x3 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat3x2 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat2x4 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat4x2 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat3x4 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< glm::mat4x3 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< gl::GLuint64 > &  value 
) const
protected
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::vector< TextureHandle > &  value 
) const
protected
template<typename T , std::size_t Count>
void globjects::AbstractUniform::setValue ( const Program program,
gl::GLint  location,
const std::array< T, Count > &  value 
) const
protected

Friends And Related Function Documentation

friend class Program
friend

Programs (de)register themselves.

Member Data Documentation

LocationIdentity globjects::AbstractUniform::m_identity
protected
std::set<Program *> globjects::AbstractUniform::m_programs
protected
std::unordered_map<const Program *, gl::GLint> globjects::AbstractUniform::m_locations
mutableprotected

The documentation for this class was generated from the following file: