sculpto
shaders_preprocessor.h
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file shaders_preprocessor.h
3 * \brief Assets manager shaders preprocessor class definition module.
4 *
5 * \author Sabitov Kirill
6 * \date 07 July 2022
7 *********************************************************************/
8
9#pragma once
10
11#include "base.h"
13
14namespace scl::assets_manager
15{
18 {
19 private:
21 static constexpr const char *LexemBlockStart = "#shader-begin";
22 static constexpr const char *LexemBlockEnd = "#shader-end";
23 static constexpr const char *LexemInclude = "#include";
24
25 /*!*
26 * Read word from string, starting at Begin iterator function.
27 *
28 * \param Begin - start point for reading word.
29 * \param End - end of reading string.
30 * \param SpacesCount - count of spkipped spaces on th left side of word.
31 * \return readed word.
32 */
33 static std::string ReadWord(std::string::const_iterator Begin, std::string::const_iterator End, int *SpacesCount = nullptr);
34
35 /*!*
36 * Get shader type from string function.
37 *
38 * \param ShaderTypeString - string, containing shader type.
39 * \return shader type enum.
40 */
41 static shader_type ShaderTypeFromString(const std::string &ShaderTypeString);
42
43 public:
44 /*!*
45 * Separate text to diffrent shader blocks function.
46 *
47 * \param ShaderDebugName - debug name to show if error occures.
48 * \param ShaderText - inptu text to separate to blocks.
49 * \param Out - output array of shaders text.
50 */
51 static void SeparateShaders(const std::string &ShaderDebugName, const std::string &ShaderText, std::vector<shader_props> &Out);
52
53 /*!*
54 * Process include directives in shader text.
55 *
56 * \param ShaderDebugName - debug name to show if error occures.
57 * \param ShaderFolderPath - path to folder where shalder is located.
58 * \param ShaderText[in, out] - text of shader to process.
59 * \return None.
60 */
61 static void ProcessIncludes(const std::string &ShaderDebugName, const std::string &ShaderFolderPath, std::string &ShaderText);
62 };
63}
Topology object basis class for mesh creating implementation module.
static void ProcessIncludes(const std::string &ShaderDebugName, const std::string &ShaderFolderPath, std::string &ShaderText)
static void SeparateShaders(const std::string &ShaderDebugName, const std::string &ShaderText, std::vector< shader_props > &Out)
shader_type
Definition: shader.h:17
Shader program interface definition module.