Radium Engine
1.5.20
Loading...
Searching...
No Matches
ShaderConfigFactory.cpp
1
#include <Engine/Data/ShaderConfigFactory.hpp>
2
3
#include <map>
4
5
#include <Core/Utils/Log.hpp>
6
7
namespace
Ra
{
8
namespace
Engine {
9
namespace
Data {
10
namespace
ShaderConfigurationFactory {
11
12
using namespace
Core::Utils;
// log
13
14
static
std::map<std::string, ShaderConfiguration>
configs;
15
16
void
addConfiguration
(
const
ShaderConfiguration
& config ) {
17
if
( config.getName().
empty
() ) {
18
LOG( logWARNING ) <<
"Empty name in ShaderConfigurationFactory::addConfiguration call. "
19
"Configuration not added"
;
20
return
;
21
}
22
23
auto
found = configs.insert( { config.getName(), config } );
24
if
( !found.second ) {
25
LOG( logDEBUG ) <<
"Configuration "
<< config.getName()
26
<<
" already in ShaderConfigurationFactory. "
27
"Configuration not added"
;
28
return
;
29
}
30
}
31
32
bool
removeConfiguration
(
const
std::string
& configName ) {
33
auto
found = configs.find( configName );
34
if
( found != configs.end() ) {
35
configs.erase( found );
36
return
true
;
37
}
38
return
false
;
39
}
40
41
Core::Utils::optional<ShaderConfiguration>
getConfiguration
(
const
std::string
& name ) {
42
if
( name.
empty
() ) {
43
LOG( logWARNING ) <<
"Empty name in ShaderConfigurationFactory::getConfiguration call."
;
44
return
{};
45
}
46
47
auto
found = configs.find( name );
48
if
( found != configs.end() ) {
return
found->second; }
49
else
{
return
{}; }
50
}
51
52
}
// namespace ShaderConfigurationFactory
53
}
// namespace Data
54
}
// namespace Engine
55
}
// namespace Ra
std::string
Ra::Engine::Data::ShaderConfiguration
Definition
ShaderConfiguration.hpp:62
std::string::empty
T empty(T... args)
std::map
Ra::Engine::Data::ShaderConfigurationFactory::addConfiguration
void addConfiguration(const ShaderConfiguration &config)
Definition
ShaderConfigFactory.cpp:16
Ra::Engine::Data::ShaderConfigurationFactory::getConfiguration
Core::Utils::optional< ShaderConfiguration > getConfiguration(const std::string &name)
Definition
ShaderConfigFactory.cpp:41
Ra::Engine::Data::ShaderConfigurationFactory::removeConfiguration
bool removeConfiguration(const std::string &configName)
Definition
ShaderConfigFactory.cpp:32
Ra
hepler function to manage enum as underlying types in VariableSet
Definition
Cage.cpp:3
src
Engine
Data
ShaderConfigFactory.cpp
Generated by
1.12.0