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 seperated 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. | |
Static Public Member Functions | |
static Shader | compile_from_source (std::string shader_name, std::string shader_source) |
Compiles a shader from source. | |
static Shader | compile_from_file (std::string shader_name, const std::filesystem::path &shader_path) |
Compiles a shader from file. | |
Private Member Functions | |
graphics::OpenGL::ShaderProgramId | compile (const ShaderParsingResult &shader_sources) |
Compile shader sources into a OpenGL shader program. | |
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 line s of the m_sources . Detects if the line contains // #shader directive and returns a pointer to the appropriate field in the ShaderParsingResult. | |
uint32_t | compile (const std::string &shader_source, ShaderType type) |
Compiles a single shader (Vertex|Fragment|Geometry) (not the whole program). | |
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 seperated 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 line
s 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 |