Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
MaterialShader.cpp
Go to the documentation of this file.
3#include "Engine/Files/Path.h"
4#include "plog/Log.h"
5
6namespace EngineCore
7{
9 const std::filesystem::path & meshShaderPath,
10 const std::filesystem::path & fragmentShaderPath
11 )
12 {
13 this->meshShaderPath = meshShaderPath;
14 this->fragmentShaderPath = fragmentShaderPath;
15 }
16
17 std::filesystem::path MaterialShader::getMeshShaderPath() const
18 {
19 if ( meshShaderPath.empty() )
20 return meshShaderPath;
21 return meshShaderPath;
22 }
23
24 std::filesystem::path MaterialShader::getFragShaderPath() const
25 {
26 if ( fragmentShaderPath.empty() )
27 return fragmentShaderPath;
28 return fragmentShaderPath;
29 }
30
32 {
33 return getMaterialNameMap().get_right().at( pipelineName );
34 }
35
40
42 {
43 if ( !pipeline )
44 {
45 PLOGF << "Trying to set null pipeline";
46 }
47 this->pipeline = pipeline;
48 }
49
54
55 std::string MaterialShader::toString() const
56 {
57 std::stringstream ss;
58 ss << " Mesh Shader: " << this->meshShaderPath.generic_string() << " Frag Shader: " << this->meshShaderPath.generic_string();
59 return ss.str();
60 }
61
62 PipelineNames MaterialShader::getPipelineNameFromString( const std::string & pipelineName )
63 {
64 if ( getMaterialNameMap().get_left().contains( pipelineName ) )
65 {
66 return getMaterialNameMap().get_left().at( pipelineName );
67 }
68 return DEFAULT_MATERIAL_PIPELINE; // default fallback
69 }
70
72 {
74 {
76 m.insert( "diffuseFlatColor", PipelineNames::DIFFUSE_FLAT_COLOR );
77 m.insert( "diffuseShader", PipelineNames::DIFFUSE_SHADER );
78 m.insert( "movableDiffuseShader", PipelineNames::MOVABLE_DIFFUSE_SHADER );
79 m.insert( "normalsShader", PipelineNames::NORMALS_SHADER );
80 m.insert( "l0Shader", PipelineNames::L0_SHADER );
81 m.insert( "l1Shader", PipelineNames::L1_SHADER );
82 m.insert( "l2Shader", PipelineNames::L2_SHADER );
83 m.insert( "dynamicTextures", PipelineNames::DYNAMIC_TEXTURES );
84 m.insert( "staticLightmap", PipelineNames::STATIC_LIGHTMAP );
85 return m;
86 }();
87 return map;
88 }
89
90} // namespace EngineCore
constexpr EngineCore::PipelineNames DEFAULT_MATERIAL_PIPELINE
Definition Settings.h:59
void insert(const T &key, const U &value)
Log category system implementation.
@ MOVABLE_DIFFUSE_SHADER
std::filesystem::path getMeshShaderPath() const
Getter for the mesh shader path.
static const BidirectionalMap< std::string, PipelineNames > & getMaterialNameMap()
PipelineMaterialPayload pipelineData
std::filesystem::path meshShaderPath
std::string toString() const
void setPipeline(GraphicsPipeline *pipeline)
Sets the pipeline which corresponds to.
std::filesystem::path fragmentShaderPath
GraphicsPipeline * getPipeline() const
PipelineMaterialPayload getPipelineData() const
std::filesystem::path getFragShaderPath() const
Getter for the fragment shader path.
GraphicsPipeline * pipeline
static std::string getPipelineNameFromString(PipelineNames pipelineName)
Gets the pipeline name as string.