MaterialShaderProgramCreator.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef ANKI_RESOURCE_MATERIAL_SHADER_PROGRAM_CREATOR_H
  2. #define ANKI_RESOURCE_MATERIAL_SHADER_PROGRAM_CREATOR_H
  3. #include "anki/util/StringList.h"
  4. namespace anki {
  5. class XmlElement;
  6. /// Creator of shader programs. This class parses between
  7. /// <shaderProgam></shaderProgram> located inside a <material></material>
  8. /// and creates the source of a custom program.
  9. class MaterialShaderProgramCreator
  10. {
  11. public:
  12. MaterialShaderProgramCreator(const XmlElement& pt);
  13. ~MaterialShaderProgramCreator();
  14. /// Get the shader program source code. This is the one and only public
  15. /// member
  16. const std::string& getShaderProgramSource() const
  17. {
  18. return source;
  19. }
  20. private:
  21. /// The lines of the shader program source
  22. StringList srcLines;
  23. std::string source; ///< Shader program final source
  24. /// Used for shorting vectors of strings. Used in std::sort
  25. static bool compareStrings(const std::string& a, const std::string& b);
  26. /// Parse what is within the
  27. /// @code <shaderProgram></shaderProgram> @endcode
  28. void parseShaderProgramTag(const XmlElement& el);
  29. /// Parse what is within the
  30. /// @code <shader></shader> @endcode
  31. void parseShaderTag(const XmlElement& el);
  32. /// Parse what is within the @code <input></input> @endcode
  33. void parseInputTag(const XmlElement& el,
  34. std::string& line);
  35. /// Parse what is within the @code <operation></operation> @endcode
  36. void parseOperationTag(const XmlElement& el);
  37. };
  38. } // end namespace anki
  39. #endif