feat: post-effects array parameters & add gfx.posteffects.set_array & make shadows opacity depending on clouds opacity

This commit is contained in:
MihailRis 2025-06-14 20:06:05 +03:00
parent 02a91e0b72
commit 436a89b066
14 changed files with 223 additions and 78 deletions

View file

@ -1,11 +1,13 @@
#pragma once
#include <vector>
#include <memory>
#include <string>
#include <variant>
#include <unordered_map>
#include <glm/glm.hpp>
#include "typedefs.hpp"
#include "data/dv_fwd.hpp"
#include "util/EnumMetadata.hpp"
@ -14,24 +16,26 @@ class Shader;
class PostEffect {
public:
struct Param {
enum class Type { FLOAT, VEC2, VEC3, VEC4 };
enum class Type { INT, FLOAT, VEC2, VEC3, VEC4 };
VC_ENUM_METADATA(Type)
{"int", Type::INT},
{"float", Type::FLOAT},
{"vec2", Type::VEC2},
{"vec3", Type::VEC3},
{"vec4", Type::VEC4},
VC_ENUM_END
using Value = std::variant<float, glm::vec2, glm::vec3, glm::vec4>;
using Value = std::variant<int, float, glm::vec2, glm::vec3, glm::vec4>;
Type type;
Value defValue;
Value value;
bool array = false;
bool dirty = true;
Param();
Param(Type type, Value defValue);
Param(Type type, Value defValue, bool array);
};
PostEffect(
@ -49,6 +53,8 @@ public:
void setParam(const std::string& name, const dv::value& value);
void setArray(const std::string& name, std::vector<ubyte>&& values);
bool isAdvanced() const {
return advanced;
}
@ -60,5 +66,6 @@ private:
bool advanced = false;
std::shared_ptr<Shader> shader;
std::unordered_map<std::string, Param> params;
std::unordered_map<std::string, std::vector<ubyte>> arrayValues;
float intensity = 0.0f;
};