#pragma once #include #include #include "WallpaperEngine/Core/DynamicValues/CDynamicValue.h" namespace WallpaperEngine::Core::Objects::Effects::Constants { /** * Shader constants base class */ class CShaderConstant : public DynamicValues::CDynamicValue { public: virtual ~CShaderConstant () = default; template [[nodiscard]] const T* as () const { if (is ()) { return static_cast (this); } throw std::bad_cast (); } template [[nodiscard]] T* as () { if (is ()) { return static_cast (this); } throw std::bad_cast (); } template [[nodiscard]] bool is () const { return typeid (*this) == typeid(T); } /** * @return String representation of the constant's value */ [[nodiscard]] virtual std::string toString () const = 0; }; } // namespace WallpaperEngine::Core::Objects::Effects::Constants