CShaderParameter.h 976 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <string>
  3. namespace WallpaperEngine::Render::Shaders::Parameters
  4. {
  5. class CShaderParameter
  6. {
  7. public:
  8. CShaderParameter (void* defaultValue, void* value, std::string type);
  9. template<class T> const T* as () const { assert (is <T> ()); return (const T*) this; }
  10. template<class T> T* as () { assert (is <T> ()); return (T*) this; }
  11. template<class T> bool is () { return this->m_type == T::Type; }
  12. const std::string& getIdentifierName () const;
  13. const std::string& getName () const;
  14. void setIdentifierName (std::string identifierName);
  15. void setName (std::string name);
  16. const void* getValue () const;
  17. virtual const int getSize () const = 0;
  18. protected:
  19. void setValue (void* value);
  20. private:
  21. std::string m_identifierName;
  22. std::string m_name;
  23. std::string m_type;
  24. void* m_defaultValue;
  25. void* m_value;
  26. };
  27. }