Reworked the way shaders are configured to reduce the amount of times clicks on buttons cause the shared shaders to reset.
This commit is contained in:
parent
19b9a4affd
commit
84a5f06dac
5 changed files with 24 additions and 25 deletions
16
shaders.cpp
16
shaders.cpp
|
@ -7,16 +7,16 @@
|
|||
#include <memory>
|
||||
|
||||
namespace shaders {
|
||||
using std::shared_ptr, std::make_shared;
|
||||
using std::shared_ptr, std::make_shared;
|
||||
|
||||
static ShaderManager SMGR;
|
||||
static bool INITIALIZED = false;
|
||||
static int VERSION = 0;
|
||||
static ShaderManager SMGR;
|
||||
static bool INITIALIZED = false;
|
||||
static int VERSION = 0;
|
||||
|
||||
bool load_shader(std::string name, nlohmann::json& settings) {
|
||||
std::string file_name = settings["file_name"];
|
||||
auto ptr = std::make_shared<sf::Shader>();
|
||||
bool good = ptr->loadFromFile(file_name, sf::Shader::Type::Fragment);
|
||||
bool load_shader(std::string name, nlohmann::json& settings) {
|
||||
std::string file_name = settings["file_name"];
|
||||
auto ptr = std::make_shared<sf::Shader>();
|
||||
bool good = ptr->loadFromFile(file_name, sf::Shader::Type::Fragment);
|
||||
if(good) SMGR.shaders.try_emplace(name, name, file_name, ptr);
|
||||
return good;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue