Shaders now are managed by a manger that can do hot reloading and it also will detect a bad shader and use an ERROR shader so you know it's busted visually.
This commit is contained in:
parent
a5b8e411e3
commit
35ced58cc9
14 changed files with 144 additions and 13 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "constants.hpp"
|
||||
#include "components.hpp"
|
||||
#include <any>
|
||||
#include "shaders.hpp"
|
||||
|
||||
namespace guecs {
|
||||
using std::shared_ptr, std::make_shared, std::wstring, std::string;
|
||||
|
@ -83,10 +84,9 @@ namespace guecs {
|
|||
|
||||
struct Shader {
|
||||
float duration = 0.1f;
|
||||
std::string name{DEFAULT_UI_SHADER};
|
||||
std::string name{"ui_shader"};
|
||||
float u_time_end = 0.0;
|
||||
bool active = false;
|
||||
std::shared_ptr<sf::Shader> ptr = nullptr;
|
||||
std::shared_ptr<sf::Clock> clock = nullptr;
|
||||
|
||||
void init(lel::Cell &cell);
|
||||
|
@ -199,7 +199,7 @@ namespace guecs {
|
|||
auto& shader = $world.get<Shader>(ent);
|
||||
|
||||
if(shader.active) {
|
||||
shader_ptr = shader.ptr.get();
|
||||
shader_ptr = shaders::get(shader.name);
|
||||
shader_ptr->setUniform("is_shape", is_shape);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue