refactor GLSLExtension.cpp & add 'param' shader preprocessor directive & add PostEffect class (WIP)

This commit is contained in:
MihailRis
2025-04-03 21:46:12 +03:00
parent 531334f059
commit 1feee3a809
8 changed files with 263 additions and 97 deletions
+15
View File
@@ -0,0 +1,15 @@
#include "PostEffect.hpp"
#include "Shader.hpp"
PostEffect::Param::Param() : type(Type::FLOAT) {}
PostEffect::Param::Param(Type type) : type(type) {}
PostEffect::PostEffect(std::unique_ptr<Shader> shader)
: shader(std::move(shader)) {
}
void PostEffect::use() {
shader->use();
}
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <memory>
#include <string>
#include <variant>
#include <unordered_map>
#include <glm/glm.hpp>
class Shader;
class PostEffect {
public:
struct Param {
enum class Type { FLOAT, VEC2, VEC3, VEC4 };
using Value = std::variant<float, glm::vec2, glm::vec3, glm::vec4>;
Type type;
Param();
Param(Type type);
};
PostEffect(std::unique_ptr<Shader> shader);
void use();
private:
std::unique_ptr<Shader> shader;
std::unordered_map<std::string, Param> params;
};