CPass.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #pragma once
  2. #include "WallpaperEngine/Core/Core.h"
  3. #include "WallpaperEngine/Core/Objects/Images/CMaterial.h"
  4. #include "WallpaperEngine/Core/Objects/Effects/Constants/CShaderConstant.h"
  5. namespace WallpaperEngine::Core::Objects {
  6. class CEffect;
  7. }
  8. namespace WallpaperEngine::Core::Objects::Images {
  9. class CMaterial;
  10. }
  11. namespace WallpaperEngine::Core::Objects::Images::Materials {
  12. using json = nlohmann::json;
  13. /**
  14. * Represents a shader pass of an object
  15. */
  16. class CPass {
  17. friend class WallpaperEngine::Core::Objects::CEffect;
  18. public:
  19. static const CPass* fromJSON (const json& data, const CMaterial::OverrideInfo* overrides);
  20. /**
  21. * @return The list of textures to bind while rendering
  22. */
  23. [[nodiscard]] const std::map<int, std::string>& getTextures () const;
  24. /**
  25. * @return Shader constants that alter how the shader should behave
  26. */
  27. [[nodiscard]] const std::map<std::string, const Effects::Constants::CShaderConstant*>& getConstants () const;
  28. /**
  29. * @return Shader combos that alter how the shader should behave
  30. */
  31. [[nodiscard]] const std::map<std::string, int>& getCombos () const;
  32. /**
  33. * @return Shader to be used while rendering the pass
  34. */
  35. [[nodiscard]] const std::string& getShader () const;
  36. /**
  37. * @return The blending mode to use while rendering
  38. */
  39. [[nodiscard]] const std::string& getBlendingMode () const;
  40. /**
  41. * @return The culling mode to use while rendering
  42. */
  43. [[nodiscard]] const std::string& getCullingMode () const;
  44. /**
  45. * @return If depth testing has to happen while rendering
  46. */
  47. [[nodiscard]] const std::string& getDepthTest () const;
  48. /**
  49. * @return If depth write has to happen while rendering
  50. */
  51. [[nodiscard]] const std::string& getDepthWrite () const;
  52. protected:
  53. CPass (std::string blending, std::string cullmode, std::string depthtest, std::string depthwrite,
  54. std::string shader, std::map<int, std::string> textures, std::map<std::string, int> combos,
  55. std::map<std::string, const Core::Objects::Effects::Constants::CShaderConstant*> constants);
  56. private:
  57. // TODO: CREATE ENUMERATIONS FOR THESE INSTEAD OF USING STRING VALUES!
  58. /** The blending mode to use */
  59. const std::string m_blending;
  60. /** The culling mode to use */
  61. const std::string m_cullmode;
  62. /** If depthtesting has to happen while drawing */
  63. const std::string m_depthtest;
  64. /** If depthwrite has to happen while drawing */
  65. const std::string m_depthwrite;
  66. /** The shader to use */
  67. const std::string m_shader;
  68. /** The list of textures to use */
  69. const std::map<int, std::string> m_textures;
  70. /** Different combo settings for shader input */
  71. const std::map<std::string, int> m_combos;
  72. /** Shader constant values to use for the shaders */
  73. const std::map<std::string, const Core::Objects::Effects::Constants::CShaderConstant*> m_constants;
  74. };
  75. } // namespace WallpaperEngine::Core::Objects::Images::Materials