linux-wallpaperengine/src/WallpaperEngine/Render/Shaders/Variables/CShaderVariable.h
Alexis Maiquez d7cf8af7ca + created global variable storage for shaders
+ added g_Time to global variable storage
- removed global g_Time from main
~ changed "shader parameters" to "shader variables" as it's a more apt naming

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
2019-09-10 13:27:18 +02:00

38 lines
973 B
C++

#pragma once
#include <string>
namespace WallpaperEngine::Render::Shaders::Variables
{
class CShaderVariable
{
public:
CShaderVariable (void* defaultValue, void* value, std::string type);
template<class T> const T* as () const { assert (is <T> ()); return (const T*) this; }
template<class T> T* as () { assert (is <T> ()); return (T*) this; }
template<class T> bool is () { return this->m_type == T::Type; }
const std::string& getIdentifierName () const;
const std::string& getName () const;
void setIdentifierName (std::string identifierName);
void setName (std::string name);
const void* getValue () const;
virtual const int getSize () const = 0;
protected:
void setValue (void* value);
private:
std::string m_identifierName;
std::string m_name;
std::string m_type;
void* m_defaultValue;
void* m_value;
};
}