|
matf-rg-engine
1.0.0
Base for project for the Computer Graphics course at Faculty of Mathematics, University of Belgrade
|
Compiles GLSL shaders from a single source file. Vertex, Fragment and Geometry shaders are separated by the // #shader vertex|fragment|geometry directive. All the code following the directive belongs to the source of the shader specified in the #shader directive. Here is an example:
More...
#include <ShaderCompiler.hpp>
Public Member Functions | |
| ShaderParsingResult | parse_source () |
Splits a single shader source string into vertex, fragment, [geometry] shader strings. More... | |
Static Public Member Functions | |
| static Shader | compile_from_source (std::string shader_name, std::string shader_source) |
| Compiles a shader from source. More... | |
| static Shader | compile_from_file (std::string shader_name, const std::filesystem::path &shader_path) |
| Compiles a shader from file. More... | |
Private Member Functions | |
| graphics::OpenGL::ShaderProgramId | compile (const ShaderParsingResult &shader_sources) |
| Compile shader sources into a OpenGL shader program. More... | |
| ShaderCompiler (std::string shader_name, std::string shader_source) | |
| std::string * | now_parsing (ShaderParsingResult &result, const std::string &line) |
Returns the output field from the ShaderParsingResult for which to continue appending lines of the m_sources. Detects if the line contains //#shader directive and returns a pointer to the appropriate field in the ShaderParsingResult. More... | |
| uint32_t | compile (const std::string &shader_source, ShaderType type) |
| Compiles a single shader (Vertex|Fragment|Geometry) (not the whole program). More... | |
Private Attributes | |
| std::string | m_shader_name |
| std::string | m_sources |
Compiles GLSL shaders from a single source file. Vertex, Fragment and Geometry shaders are separated by the // #shader vertex|fragment|geometry directive. All the code following the directive belongs to the source of the shader specified in the #shader directive. Here is an example:
|
inlineprivate |
|
static |
Compiles a shader from source.
| shader_name | |
| shader_source | string for the vertex, fragment, [geometry] shader |
|
static |
Compiles a shader from file.
| shader_name | |
| shader_path | containing the source for the vertex, fragment, [geometry] shader |
| ShaderParsingResult engine::resources::ShaderCompiler::parse_source | ( | ) |
Splits a single shader source string into vertex, fragment, [geometry] shader strings.
|
private |
Compile shader sources into a OpenGL shader program.
|
private |
Returns the output field from the ShaderParsingResult for which to continue appending lines of the m_sources. Detects if the line contains //#shader directive and returns a pointer to the appropriate field in the ShaderParsingResult.
|
private |
Compiles a single shader (Vertex|Fragment|Geometry) (not the whole program).
| shader_source | |
| type | of the shader to compile Vertex|Fragment|Geometry |
|
private |
|
private |