#pragma once #include #include #include #include #include "../TextureProvider.h" #include "WallpaperEngine/Render/Shaders/Variables/ShaderVariable.h" #include "GLSLContext.h" #include "ShaderUnit.h" #include "WallpaperEngine/Data/Model/Types.h" namespace WallpaperEngine::Render::Shaders { using json = nlohmann::json; using namespace WallpaperEngine::Render; using namespace WallpaperEngine::Data::Model; class Shader { public: struct ParameterSearchResult { Variables::ShaderVariable* vertex; Variables::ShaderVariable* fragment; }; Shader ( const AssetLocator& assetLocator, std::string filename, const ComboMap& combos, const ComboMap& overrideCombos, const TextureMap& textures, const TextureMap& overrideTextures, const ShaderConstantMap& constants ); const std::string& vertex (); const std::string& fragment (); /** Empty when there is no geometry stage */ const std::string& geometry (); [[nodiscard]] const ShaderUnit& getVertex () const; [[nodiscard]] const ShaderUnit& getFragment () const; [[nodiscard]] const std::map& getCombos () const; /** Searches both the vertex and fragment shader units for a parameter with this name */ [[nodiscard]] ParameterSearchResult findParameter (const std::string& name) const; private: ShaderUnit m_vertex; ShaderUnit m_fragment; /** GS_ENABLED shaders with a .geom, like WE's particle shaders (its renderer always sets that define) */ std::unique_ptr m_geometry; std::string m_file; const ComboMap& m_combos; const TextureMap m_passTextures; }; } // namespace WallpaperEngine::Render::Shaders