refactor GLSLExtension.cpp & add 'param' shader preprocessor directive & add PostEffect class (WIP)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user